Home » SQL & PL/SQL » SQL & PL/SQL » How to query records with same value in specific columns from a table
How to query records with same value in specific columns from a table [message #18373] Tue, 29 January 2002 14:16 Go to next message
Hung Sheng Chen
Messages: 1
Registered: January 2002
Junior Member
Dear all,
1. I am writing a sql to query records with same value in specific columns from a table. For example,in below table, I want to query records with the same name in the same sex. So,the result should be two records with the name Mary.
2. Please tell me how to write the SQL statement?
Name Sex Age
---- --- ---
Mary F 23
John M 40
Mary F 45
Re: How to query records with same value in specific columns from a table [message #18377 is a reply to message #18373] Tue, 29 January 2002 15:36 Go to previous message
Suresh Vemulapalli
Messages: 624
Registered: August 2000
Senior Member
select a.name,a.sex,a.age from tab1 a,(select * from tab2 group by name,sex having count(*)>1) b
where a.name=b.name and a.sex=b.sex;
Previous Topic: Duplicates
Next Topic: Help, procedure not compiling
Goto Forum:
  


Current Time: Thu Aug 13 07:21:46 CDT 2020