开发者

Mysql join 2 database and 3 tables query?

开发者 https://www.devze.com 2022-12-12 03:28 出处:网络
SELECTdb1_t1.userid as userid , db1_t1.customer_id as vw_customer , db2_t1.customers_id as customer , db2_t1.orders_id as order
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_t开发者_如何学编程1.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.


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`
0

精彩评论

暂无评论...
验证码 换一张
取 消