Home » SQL & PL/SQL » SQL & PL/SQL » Removing duplicates ?
Removing duplicates ? [message #318371] Tue, 06 May 2008 11:12 Go to next message
shoaib123
Messages: 118
Registered: December 2007
Location: Chicago
Senior Member

select a.prop_insp_request_id 
from prop_appr_results a 
where a.prop_insp_request_id in
(select max(b.prop_insp_req_id) from prop_insp_requests b
where  a.prop_insp_request_id = b.prop_insp_req_id ) 


i am trying to remove duplicates out of this query, somehow i endup getting duplicates value.
I am trying to match the max value of table b with table a, but for some reason the query also producing the unmatch value from table a.

If it is not clear for someone let me know i will explain differently but Any help would be appreciate.

[Updated on: Tue, 06 May 2008 11:15]

Report message to a moderator

Re: Removing duplicates ? [message #318377 is a reply to message #318371] Tue, 06 May 2008 12:03 Go to previous messageGo to next message
Littlefoot
Messages: 20900
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Duplicates out of a query? Would DISTINCT help?

Or, if you are about to remove duplicates from a table, check the answer to this FAQ.
Re: Removing duplicates ? [message #318378 is a reply to message #318371] Tue, 06 May 2008 12:06 Go to previous message
shoaib123
Messages: 118
Registered: December 2007
Location: Chicago
Senior Member

Never mind.. i have solved this problem .. there is a dummy mistake ...i just realized in the query.
Previous Topic: How to find the counts for records inserted 30 minutes before
Next Topic: Dynamically inserting records in output based on some conditions
Goto Forum:
  


Current Time: Wed Dec 07 18:16:26 CST 2016

Total time taken to generate the page: 0.15988 seconds