求合并数据SQL语句编写方法

[复制链接]
查看11 | 回复0 | 2012-3-8 09:22:00 | 显示全部楼层 |阅读模式


111.JPG (3.15 MB, 下载次数: 2)
下载附件
2012-3-8 09:17 上传

如上图所示,上图所描述的数据是通过多表关联查询出来的数据,现在需要将红色标注的数据过滤出来,请问这样的SQL语句要怎么进行编写。
--------------------多表关联查询的SQL语句----------------------------
select distinct a.statusid,
a.xmname,
d.dwname,
a.gzxlcode,
e.gzlbname,
e.shortname,
a.ljwctfs,
a.ljwcmj,
a.ljwcfgbl,
a.bnwctfs,
a.bnsstfs,
a.bnssmj,
a.zycz,
a.dfcz,
a.shzj,
e.gzlbsign,
a.gzdcode,
a.zt,
a.ct,
a.kt,
a.qj,
a.bz,
a.by1
from ta_jcdz a
left join ta_bbzt b
on a.statusid = b.statusid
left join ta_cant c
on c.supercode = a.sssf
and a.ssds = c.cantcode
left join ta_dwzd d
on d.dwcode = b.dwcode
left join ta_zglbzd e
on a.gzxlcode = e.gzlbcode
where b.bbcode = 1
and d.dwsssf like '43%'
and b.year = 2011
and b.tbtype = 1
and (b.bbstatus=4 or b.prlookst = 1)
order by a.xmname;
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行