Welcome to WebmasterWorld Guest from 54.146.201.80

Forum Moderators: open

Message Too Old, No Replies

simple sql left join problem

     
3:29 pm on Jun 13, 2011 (gmt 0)

Junior Member

joined:May 3, 2011
posts: 64
votes: 0


Can anybody see why I'm getting the error:
#1064 - 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 'order LEFT JOIN product ON order.idProduct = product.idProduct WHERE order.idCus' at line 1


with the following query:

SELECT product.product_name, product.product_type, order.order_status, order.order_date, order.order_desc
FROM order LEFT JOIN product ON order.idProduct = product.idProduct
WHERE order.idCustomer = 21
ORDER BY order.order_date


when all the field names and table names are right?
4:41 pm on June 13, 2011 (gmt 0)

Administrator

WebmasterWorld Administrator coopster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:July 31, 2003
posts:12533
votes: 0


"order" is a reserved word in MySQL.
[dev.mysql.com...]
4:57 pm on June 13, 2011 (gmt 0)

Senior Member

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Nov 28, 2004
posts:7999
votes: 0


Right, backtick `` (not quote) table and field names.
8:43 pm on June 13, 2011 (gmt 0)

Junior Member

joined:May 3, 2011
posts: 64
votes: 0


thanx a mil :-)