我有 4 个表要加入到一个 sql 语句中。
这些是我的表:
- exp_members : card_id (pk)
- 交易:card_id(pk), restaurant_id(pk)
- exp_channel_data : restaurant_id(pk)
- exp_channel_titles : restaurant_id(pk)
我已经尝试过这样的声明,但这不起作用
SELECT cm.*, t.*, cd.*, ct.*
FROM exp_members as cm
Inner JOIN transactions as t on (cm.card_id = t.restaurant_id)
Inner JOIN exp_channel_titles as ct on (ct.restaurant_id = t.restaurant_id)
Inner JOIN exp_channel_data as cd on (cd.restaurant_id = ct.restaurant_id)
order by t.created DESC limit 50