Skip to Main Content
  • Questions
  • a sql query which pulls all the record with the same first name and email and if one row has email and other has no email but i have same phone number in cluster

Breadcrumb

May 4th

Question and Answer

Connor McDonald

Thanks for the question, sona.

Asked: August 22, 2016 - 5:26 pm UTC

Last updated: August 23, 2016 - 1:51 am UTC

Version: oracle 10.1.2

Viewed 1000+ times

You Asked

a sql query which pulls all the record if one cluster has same first name ,last name and one (i.e 22 )has email and other has no email but i have same Phone number
There are about million of records,i have to fetch all the records according to the criteria

for eg:

CLUSTER_ID last_NAME first_NAME EMAIL phone

22 a ken ken@a.com 012

22 a ken 012

27 b john john@b.com 345

27 b john 345

and Connor said...

Something like this perhaps ?

select a.cluster_id, b.cluster_id, a.first_name , a.last_name, a.email, a.phone
from   my_table a, my_table b
where  a.first_name = b.first_name
and    a.last_name = b.last_name
and    a.phone = b.phone
and    a.email is not null
and    b.email is null



Is this answer out of date? If it is, please let us know via a Comment