Results 1 to 3 of 3
Thread: Mysql syntax problem
Jun 27, 2004, 10:03 #1
Mysql syntax problem
I have an ASP aplication (which isn't written by me), connected to an Access Database, but recently they asked me to change it to MySQL.
Although i'm a newbie in this matters of dinamic pages, I was able to configure "almost" all the ASP programation to work correctly with Mysql.
But i have a single problem which is:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[MySQL][ODBC 3.51 Driver][mysqld-4.0.20a-debug]You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'select produtocategoria.id_cat_prod as ctl from produtocategori
/manuquimica/sec/DetalheProduto.asp, line 118
And the piece of code indicated by the error is this:
var strQryCP="select categoria.id_cat_prod, cat_desc, ctl FROM " strQryCP +="CATEGORIA left join " strQryCP += "(select produtocategoria.id_cat_prod as ctl from produtocategoria where produtocategoria.id_prod="+id+") as t1 " strQryCP +="on categoria.id_cat_prod=t1.ctl "
I've read that are some diferences in the way MySQL handles the code, such as the caracther ', anyway i just can't seem to resolve this syntax problem.
I´ve posted this question in the ASP Forum, and they said it would be wise to post it here.
Thanks for your patience
Jun 27, 2004, 15:25 #2
- Join Date
- Jul 2002
- Toronto, Canada
- 63 Post(s)
- 3 Thread(s)
mysql doesnb't support subqueries until version 4.1
try this instead --
select categoria.id_cat_prod , cat_desc , produtocategoria.id_cat_prod as ctl from categoria left join produtocategoria on categoria.id_cat_prod = produtocategoria.id_cat_prod and produtocategoria.id_prod = id
Jun 28, 2004, 07:33 #3
Thanks for the information, but i think there's more in the code i have to change, in order to make it work, i replaced the code by the one you said but unfortunately it still gives me an error, althought i changed my version of MySQL, and everything runs smoothly, my only problem is, if the server hosting this aplication have the latest version of MySQL, if not i will be in deep troubles, ehehehehe.
Anyway, thanks alot for your tip, it sure helped me.