# 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
三表左连接
最新推荐文章于 2024-04-23 15:26:09 发布
# 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