Jump to content

MySQL Query Error (Access -> MySQL)


miffe
 Share

Recommended Posts

Greetings,I Recently moved my DB from Access to MySQL using the Migrator tool, but I had an MS Excel file that I expected would work flawlessly, all queries should have worked the same, but... PROBLEM... the queries were created with MS Access assistance originally, therefore following the JET system.I would appreciate it if I could get a little assistance with the following SQL, it just doesn't work in MySQL... considering I have all the data, but I don't know how to express it... I need the formulas to take place with the math operations shown in this SQL:

SELECT modelos.idModelo, modelos.nombre AS Modelo, colores.color, brillantes.tamanoPiedra AS BTE, tiposJoyas.nombreTipo,Round(Sum([valorVenta]+((brillantes!costoBTE*brillantes!importacion*brillantes!utdBruta/brillantes!comisionRep*brillantes!tamanoPiedra)+((ensambleMontadura!precioOro*32.15/1000*0.585+ensambleMontadura!costoAleacion+ensambleMontadura!utdBruta/ensambleMontadura!comisionRep+ensambleMontadura!costoEnsamble)*modelos!pesoMontadura))/2)) AS Normal,Round((Sum([valorVenta]+((brillantes!costoBTE*brillantes!importacion*brillantes!utdBruta/brillantes!comisionRep*brillantes!tamanoPiedra)+((ensambleMontadura!precioOro*32.15/1000*0.585+ensambleMontadura!costoAleacion+ensambleMontadura!utdBruta/ensambleMontadura!comisionRep+ensambleMontadura!costoEnsamble)*modelos!pesoMontadura))/2)/0.9)) AS AltaFROM tiposJoyas INNER JOIN (insumosFijos INNER JOIN (ensambleMontadura INNER JOIN (colores INNER JOIN (categoriasModelos INNER JOIN (brillantes INNER JOIN ((modelos INNER JOIN modelosInsumos ON modelos.idModelo=modelosInsumos.idModelo) INNER JOIN modelosColores ON modelos.idModelo=modelosColores.idModelo) ON brillantes.idTipoBTE=modelos.BTE) ON categoriasModelos.idCategoria=modelos.idCategoria) ON colores.idColor=modelosColores.idColor) ON ensambleMontadura.idEnsamble=modelos.idEnsamble) ON insumosFijos.idInsumo=modelosInsumos.idInsumo) ON tiposJoyas.idTipoJoya=modelos.idTipoGROUP BY modelos.idModelo, modelos.nombre, colores.color, brillantes.tamanoPiedra, tiposJoyas.nombreTipo, categoriasModelos.idCategoria

Thanks a lot,Miffe

Link to comment
Share on other sites

It's probably syntax like this that MySQL doesn't like: brillantes!costoBTEChange that to this: brillantes.costoBTEThe things in square brackets might also be a problem. What error messages are you seeing from MySQL?
I changed all ! to . in the query but I get an error back from the MyODBC driver saying: You have an error in your SQL syntax; check the manual... for the right syntax near '[ValorVenta]+((brillantes.costo*brillantes.importacion*brillantes.utdBruta/br' at line 1.I guess the [ ]'s are the problem, how can I change this to MySQL's SQL?I'd post the tables and everything involved but I think it's quite a lot of unnesessary info when all I need is just the SQL syntax.Thanks.
Link to comment
Share on other sites

Just remove them. What are they? Is ValorVenta a column name?
FLAWLESS! Thanks a lot for the help here, I know the question was kinda stupid and maybe I would have figured it out sooner or later, but your help is greately appreciated!Thanks a lot -Miffe
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...