去重复数据
select distinct substr(c.D_NUMBER,0,10) from DCZYDDXXB c ,pmdwxxb p ,ss_dept ss where substr(c.D_NUMBER,0,10)=p.DWBM and ss.deptid=p.dwbm and c.Ddrq>='20100513' and c.ddrq <='20100514'
中的数据为
6501030009
6501020015
6501020013
6501050005
6501030005
6501030013
6501020008
6501020011
6501050012
6501020007
6501020002
6501050003
6501020006
6501030007
select distinct substr(c.D_NUMBER,0,10) from FCDYDDXXB c ,pmdwxxb p ,ss_dept ss where substr(c.D_NUMBER,0,10)=p.DWBM and ss.deptid=p.dwbm and c.Ddrq>='20100513' and c.ddrq <='20100514'
6501020015
2 6501030006
3 6501040002
4 6501050004
5 6501030007
select distinct substr(c.D_NUMBER,0,10) from clzyddxxb c ,pmdwxxb p ,ss_dept ss where substr(c.D_NUMBER,0,10)=p.DWBM and ss.deptid=p.dwbm and c.Ddrq>='20100513' and c.ddrq <='20100514'
1 6501050005
2 6501030005
把这三张表的数据去除重复的
------解决方案--------------------这三条语句中间加一个union 就好了