Welcome to WebmasterWorld Guest from 174.129.135.89

Forum Moderators: open

Message Too Old, No Replies

simple sql left join problem

   
3:29 pm on Jun 13, 2011 (gmt 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 Jun 13, 2011 (gmt 0)

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



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

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



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



thanx a mil :-)