请教大师们,一个连接查询的问题

来源:百度知道 编辑:UC知道 时间:2024/06/23 04:34:37
select dbo.t_searchresult.* ,dbo.t_category.category ,dbo.t_websource.chanerurl ,0 as stype,t_R_Websource_Sresult.websource_sresultID as pkid,t_R_Websource_Sresult.getdate ,t_R_Websource_Sresult.changedate
from t_searchresult
left join
t_R_Websource_Sresult on t_R_Websource_Sresult.Sresultid=t_searchresult.sid
left join
t_category on t_category.categoryid=t_R_Websource_Sresult.categoryid
left join
t_websource on t_websource.websourceid=t_R_Websource_Sresult.websourceid

这样的链接的意义和内联有什么区别呢

如果改成内联应该怎么写,区别是?

left join 取出左边表中所有数据
inner join 只取两表中符合条件的部分数据

比方说 select * from a left join b on....
此时会取出A表中所有的数据,B表中没有符合ON后面条件的显示为null
但是 select * from a inner join b on....
此时会取出a表和b表中符合on后面表达式的部分数据

这样解释应该很明白了吧?