SQL 中left join连接多张表
来源:学生作业帮 编辑:神马作文网作业帮 分类:综合作业 时间:2024/09/29 01:27:59
SQL 中left join连接多张表
因为业务原因查询多张表,如此:
select
from table A
left join table A1 on .
left join table A2 on .
left join table A3 on .
left join table A4 on .
left join table A5 on .
left join table A6 on .
left join table A7 on .
left join table A8 on .
left join table A9 on .
left join table A10 on .
left join table A11 on .
left join table A12 on .
where
.
这样的一个语句,确实是有十几张表需要连接(数据库表结构就是这样.)
这种写法查询效率怎么样,还有没有更好的写法
因为业务原因查询多张表,如此:
select
from table A
left join table A1 on .
left join table A2 on .
left join table A3 on .
left join table A4 on .
left join table A5 on .
left join table A6 on .
left join table A7 on .
left join table A8 on .
left join table A9 on .
left join table A10 on .
left join table A11 on .
left join table A12 on .
where
.
这样的一个语句,确实是有十几张表需要连接(数据库表结构就是这样.)
这种写法查询效率怎么样,还有没有更好的写法
这样写效率肯定不高.如果数据大,很有可能把数据库跑死.
遇到这种情况,建议使用临时表,写成存储过程.把要查询的数据分字段插入临时表,然后再查询临时表.
遇到这种情况,建议使用临时表,写成存储过程.把要查询的数据分字段插入临时表,然后再查询临时表.
SQL 中left join连接多张表
sql表连接查询的区别`inner join、left join、rightjoin、outer join举例说明·
SQL中 inner join、 left join 、right join、 outer join之间的区别
sql中left join from 多个表怎么写
sql语句中join ,left join ,right join有什么区别
SQL Left join 用法 以下SQL 语句如何完成?
这句sql语句怎么改成left join的
SQL语句(inner join,left out join,right out join三者的不同用法)
sql 中 select * from A left join B on A.id=B.id where A.id=?如
SSH怎么使用外连接.right join,left join
right join/left join/full join这三种外连接主要用在什么条件下?
求将带条件的left join on的SQL转换成HQL