Home » SQL & PL/SQL » SQL & PL/SQL » Query to find Duplicate set of values
Query to find Duplicate set of values [message #253343] Mon, 23 July 2007 10:17 Go to next message
135478
Messages: 5
Registered: March 2007
Location: Pune
Junior Member
Hello Experts,

Need your help to write one query.

My problem: I have one table rah and its structure is below

Field Names Data type
----------------------------------------
pkey Number (primary key)
usid Number
product varchar2


Data in the table is like that

pkey usid product
----------------------
101 1 AA
102 1 AA
103 2 AA
104 2 BB
105 3 BB
106 3 AA
107 4 AA
108 4 BB
109 4 CC


Now my requirement is like that i want those usid's who are having exactly duplicate set of product values. like From the above data query should return only below rows
103 2 AA
104 2 BB
105 3 BB
106 3 AA

here usid 2 and 3 are having duplicate set of product (AA& BB)

I have simulated my project requirment in above example.

Thank you all in advance. Please do let me know if u need more info.

Thanks & Regards,
Khaled
Re: Query to find Duplicate set of values [message #253344 is a reply to message #253343] Mon, 23 July 2007 10:20 Go to previous messageGo to next message
Michel Cadot
Messages: 64102
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Please read and follow How to format your posts and How to get a quick answer to your question: TIPS AND TRICKS
Make sure that lines of code do not exceed 80 or 100 characters when you format.
Please always post your Oracle version (4 decimals).

Post what you already tried and why it failed.

Regards
Michel

[Updated on: Mon, 23 July 2007 10:20]

Report message to a moderator

Re: Query to find Duplicate set of values [message #253610 is a reply to message #253344] Tue, 24 July 2007 07:09 Go to previous messageGo to next message
tarunj
Messages: 23
Registered: April 2007
Location: Noida
Junior Member
I think the output for which u ask the solution is wrong bcoz usid 2 has only two products AA & BB and same for usid 3.

select pkey,usid,product from t_name group by usid,product having count(1)>1;

will give u:
101 1 AA

In Case I m wrong plz clarify ur needs.
Re: Query to find Duplicate set of values [message #253631 is a reply to message #253610] Tue, 24 July 2007 07:53 Go to previous messageGo to next message
joy_division
Messages: 4640
Registered: February 2005
Location: East Coast USA
Senior Member
tarunj wrote on Tue, 24 July 2007 08:09

In Case I m wrong plz clarify ur needs.


Please write in english. The pig latin forum is located elsewhere.
Re: Query to find Duplicate set of values [message #253901 is a reply to message #253631] Wed, 25 July 2007 05:02 Go to previous messageGo to next message
tarunj
Messages: 23
Registered: April 2007
Location: Noida
Junior Member
This is not an english forum or latin forum.
It doesn't matter whether u write in english or latin, but it should b related to oracle
Re: Query to find Duplicate set of values [message #253912 is a reply to message #253901] Wed, 25 July 2007 05:22 Go to previous message
Michel Cadot
Messages: 64102
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Yes this is an english forum.
Other language forum are in the "Non-English Forums" section.

Regards
Michel
Previous Topic: table type
Next Topic: Sorting for stragg function column
Goto Forum:
  


Current Time: Fri Dec 02 20:58:09 CST 2016

Total time taken to generate the page: 0.10334 seconds