基本思想
首先,找出表中与其他所有表都有联系的一张表;然后其他的表都连接在他的后面,并用字段联系起来。
基本结构
FROM (((表 1 INNER JOIN 表2 ON 表1.字段号=表2.字段号) INNER JOIN 表3 ON 表1.字段号=表3.字段号) INNER JOIN 表4 ON 表1.字段号=表4.字段号) INNER JOIN 表X ON 表1.字段号=表X.字段号
select a.content,b.content,c.name,d.nick
from space_post a
LEFT/INNER JOIN user_report b on a.id = b.id_post
LEFT JOIN space c on a.id_space = c.id
LEFT JOIN user d on a.id_user = d.id
where a.is_delete = 0 and b.is_delete = 0 and c.is_delete = 0 and d.is_delete = 0