views:

53

answers:

1
SELECT      db1_t1.userid as userid
            , db1_t1.customer_id as vw_customer
            , db2_t1.customers_id as customer
            , db2_t1.orders_id as order
FROM        database1.table1 db1_t1
LEFT JOIN   database2.table1 db2_t1 
ON        db1_t1.customer_id = db2_t1.customers_id

It gives me this error:

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 FROM database1.table1 db1_t1 LEFT JOIN database2.' at line 2

I am using php and mysql

+2  A: 

order is a keyword - think ORDER BY my_column.

I'd suggest renaming it, but you could enclose it in backticks

db2_t1.orders_id AS `order`
Greg
yep.. it works now. Thanks for the answer.
mysqllearner