我有两个表 - char_items
和items
。 item_id是这两个表中的一个通用字段。MySQL内部联接查询给出错误
我想从'char_items'表中读取item_id,并根据item_id从'items'表中获取其他信息。但是我的查询在MySQL中显示为不正确。请帮助 -
SELECT * FROM `char_items` WHERE char_id=$char_id && isSlotted=1 INNER JOIN `items` ON char_items.item_id=items.item_id
我不断收到的消息:
#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 'INNER JOIN `items` ON char_items.item_id=items.item_id
LIMIT 0,30' 在行1
我想是这样的 - SELECT * FROM'char_items' INNER JOIN'items' WHERE char_id = $ char_id && isSlotted = 1 ON char_items.item_id = items.item_id - 但它仍然给类似的错误。我对MySQL非常陌生,所以我一点也不明白。 –
Where子句仍然不在正确的位置。应该先来。 –
另外,我可能是错的,但我认为&&应该是AND。 –