日期:2014-05-17 浏览次数:20798 次
select a.1, a.2 from a, b
------解决方案--------------------
去掉那段查询逻辑。
------解决方案--------------------
---无视B select a.id, b.name from a, b where a.id=b.id(+) ---无视A select a.id, b.name from a, b where a.id(+)=b.id
------解决方案--------------------
s.infoid(+) = a.id
这个A表跟S表是什么关系?
如果是一对一或者多对一 就不会重复
如果是一对多或者多对多就会重复 不知道我理解的对不对
select distinct a.*,u.*,d.* from PC12315_INFO_TD a,
base_user_info u,
PC_DEPARTMENT_TC d,
pc_distribute_td s
where a.accRegId = u.id(+)
and a.regDepId = d.id(+)
and a.dealNo is null
and s.infoid(+) = a.id
and ((a.currentState = '2' and
(a.regDepId = :dep or a.currentDeptId = :dep)) or
(a.currentState in ('7', '0') and
a.currentDeptId = :dep and a.regDepId != :dep and
s.accDeptId = :dep))
and a.regTime >= to_date(:beginDate, 'yyyy-MM-dd')
and a.regTime <=
to_date(:endDate, 'yyyy-MM-dd hh24:mi:ss')
order by a.regTime desc
这样应该就能过滤掉因为S表 而重复的记录