Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
jayanth_jyothi
Starting Member
11 Posts |
Posted - 2005-10-06 : 00:22:09
|
| Customer table having custid,cust_name,homephone,workphone fields..in that table there is same phone numbers for two or three customers.. i want distinct homephoneno,workphone from that table and only one customer... please give me the query |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-10-06 : 00:29:34
|
| Try thisSelect Customer,homephoneno,workphone from Customer C where homephoneno=(Select top 1 homephoneno from Customer where custid=C.custid)Otherwise post some sample data and the result you wantMadhivananFailing to plan is Planning to fail |
 |
|
|
jayanth_jyothi
Starting Member
11 Posts |
Posted - 2005-10-06 : 04:59:51
|
| Thank u madhivanan for sending.. but its not comming.. now i am sending the datacust_id cust_lname cust_homephone cust_workphone 12717 Rajkumar 01303223294 07986382816 12037 Mayank Gohil 01303223294 01303224513 28413 dsdsds 02073606070 01158467685 11724 speddireddi 02073606077 02073606077 22964 satya 02414120406 02414126859 38271 ravishanker siddamsetty 07618812588 01797381667 13160 Mr B.K Jasti 02088887949 02088887949 11858 chilakapati rajeev 02088887949 02088887949 11866 kadiyala vinay kumar 02088887949 02088887949 13160 Mr B.K Jasti 02088887949 02088887949 in that Rajkumar,Mayank Gohil have same phone numbers.. but i want only rajkumar reord |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-10-06 : 05:16:45
|
| Try thisSelect cust_id,cust_lname,cust_homephone,cust_workphone from Customer C where cust_id=(Select top 1 cust_id from Customer where cust_homephone=C.cust_homephone)MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|