三表左连接

来源:互联网 发布:json在线解析器 编辑:程序博客网 时间:2024/06/06 12:51

# t2id字段是table_1表和table_2表关联的字段
# t3id字段是table_2表和table_3表关联的字段

SELECT COUNT(*)
FROM table_1 t1
LEFT JOIN table_2 t2
ON t1.t2id=t2.id
LEFT JOIN table_3 t3
ON t2.t3id=t3.id