Duplicates in Result set
777930Jun 8 2010 — edited Jun 9 2010OK, so this is one big ugly query that a co worker has handed me to work on because he can't figure out why it is spitting out many duplicate rows in the result set. Using Oracle, and PL/SQL. Three tables, and a number of rows. Any suggestions on how to get rid of the duplicates?
Thanks
Select Ltrim(Rtrim(Table1.Column1)) Column1a,
Test_Folder(Table1.Column2) Column2a,
Table1.Column2,
Upper(Table2.ColumnA) ColumnA1,
Table1.Column3,
Test2_DelRet(Table1.Column2) Delinquent,
Test3_AR(Table1.Column2) AR,
Table3.ColumnF
FROM Table1, Table2, Table3
WHERE Table1.Column4= Table2.Column4
AND Table1.Column2 = Table3.Column2
AND Table1.Column5 in ('60','80','90','155','158')
AND Table1.Column6 = 10
AND LTRIM(RTRIM(Column8)) = 'USER'
AND Table3.ColumnF
in
(SELECT Table3.ColumnF
from Table3
where Table3.ColumnF < (sysdate - 1850))
and Table1.Column2
in
(Select unique Column2
from Table1
group by Column2)
Edited by: user10526641 on Jun 8, 2010 11:58 AM