当前有三个表 :
- CommercialNews as a
- WebCommunity as b
- CommercialNewsOriginalWebsite as c
条件是 a.idcommunity = b.webid , a.originalWebid = c.idnumber
要求从三个表里查出符合上述条件的 以下字段,并以 a.creadate 进行desc降序排序:
- a.idnumber
- a.creadate
- a.description
- a.fileurl
- a.title
- b.wname
- c.webName
- c.logo
最后sql语句为:
select a.idnumber,a.creadate,a.description,a.fileurl,a.title,b.wname,c.webName,c.logo
from commercialnews as a
left join webcommunity as b on a.idcommunity = b.webid
left join CommercialNewsOriginalWebsite as c on a.originalWebid = c.idnumber order by a.creadate desc;