Learner2011
Learner2011

Reputation: 385

SQL Query to display unique records

I have 3 columns email,fname,lname I want to Query to display unique records taking into account it should pick only one records if more than one record exists with same email,same fname and same lname.What should be the Query like?

Upvotes: 0

Views: 1299

Answers (1)

Rajesh Chamarthi
Rajesh Chamarthi

Reputation: 18818

select email, lname, fname
  from table1
  group by email, lname, fname
  having count(*) > 1  --only records with duplicates, 
                       --group by will return only one occurance

Upvotes: 2

Related Questions