Hi,
I have two table Employee,Phone how get only empid and phone number with distinct phone number below table
Employee
empid name
1 siva
2 jose
3 ramya
------
Phone
empid phone
1 9960076000
1 8860076000
2 7760076000
3 9160076000
2 9060076000
3 9060076000
Akkiraju IvaturiPosted Aug 27, 2012, 3:08 AM
Santhosh Kumar JayaramanPosted Aug 26, 2012, 9:35 AM
In your phone table, you have only id and phone number and you need empid and phonenumber as output. Then you no need to use employee table..
This phone table should already have distinct records it looks like. For each empno, same phone number wont be inserted twice.
Even in case if you have same phone number twice for an employee, then use group by/distinct
Select empid,phone from phone group by empid, phone
or select distinct empid, phone from phone
Vilas GitePosted Aug 26, 2012, 8:09 AM
please use Distinct with join query
Thanking you!