
Sql代码 CREATE VIEW view_name AS SELECT t1.xxx, t2.xxx, t3.xxx FROM (table1 t1
INNER JOIN table2 t2 ON t1.fid = t2.fid) INNER JOIN table3 t3 ON t1.mid = t3.mid 这里使用了3表关联,对于多表关联的 INNER JOIN
写法有一个技巧1. 先写最简单的2表关联 INNER JOIN2. 然后使用 () 从 FROM 之后到
语句结尾全部扩起来3. 在语句
结尾开始连接与下一个表的 INNER JOIN记住这个原则,未来进行4表关联,5表关联就都不是什么难事了select distinct id,name,mobile,city from table1 left join table2 on table1.id = table2.table1_id
评论列表(0条)