Reputation: 13
I tried to make a inner join query from these two tables but I get error every time. customer table consist custId,custName,custPhone (custId is PK) order table consist orderId,custId,orderDate (orderId is PK and custId is FK) the error is :
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 On customer.custId=order.custId LIMIT 0, 30' at line 2
Select * From customer
Inner Join order
On customer.custId=order.custId
Upvotes: 0
Views: 112
Reputation: 24002
Order
is a reserved word. Surround it with back quotes '`'
Select * From customer
Inner Join `order`
On customer.custId=`order`.custId
Usage of reserved words as object names is not encouraged. Better change it to some other acceptable name like orders
or customer_orders
, or something else.
Refer to: MySQL Reserved Words
Upvotes: 3