简体   繁体   中英

MYSQL Syntax Error LEFT JOIN

Im having issues trying to figure out this syntax error. Heres the SQL query:

SQL QUERY

SELECT oh.date_modified, oh.physicianNote, os.name AS status
FROM order oh 
LEFT JOIN order_status os ON oh.order_status_id = os.order_status_id
WHERE oh.order_id = '118' AND os.language_id = '1'
ORDER BY oh.date_added ASC LIMIT 0,10

SQL 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 oh LEFT JOIN order_status os ON oh.order_status_id = os.order_status_i' at line 2

Not really sure whats wrong with it.

ORDER is a reserved word . Quote it in backticks:

SELECT   oh.date_modified, oh.physicianNote, os.name AS status
FROM     `order` oh LEFT JOIN order_status os USING (order_status_id)
WHERE    oh.order_id = '118' AND os.language_id = '1'
ORDER BY oh.date_added
LIMIT    0,10

"ORDER" is reserved word. This is error. Use the word order Quote in backticks

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM