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 |
rajnidas
Yak Posting Veteran
97 Posts |
Posted - 2014-08-02 : 02:50:52
|
hi all,i need your help for following query, when we execute the query the following result is getting.SELECT COURIERCODE,WAYBILLSTARTSERIES,WAYBILLENDSERIES FROM waybill_masterWHERE COURIERCODE IN( SELECT COURIERCODE FROM waybill_master WHERE waybillstartseries=waybillendseries)ORDER BY WAYBILLSTARTSERIES,WAYBILLENDSERIES DESCgetting result-----'MAR', '25', '25''MAR', '26', '200''MAR', '26', '50''SUN', '100', '100''MOON', '200', '200''MOON', '201', '250''VENUS', '500', '500''EARTH', '200','200''EARTH', '500','500'we need result ----------------'SUN', '100', '100''VENUS', '500', '500''EARTH', '200','200''EARTH', '500','500'IF ANY RECORD EQUAL WE NEED ONLY THAT DATA OR IF THE RECORD WITH THE SAME NAME WITH NOT EQUAL SHOULD NOT APPEAR. KINDLY NEED HELP.THANKS RAJNIDAS |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2014-08-02 : 05:41:45
|
[code]SELECT *FROM Table tWHERE NOT EXISTS (SELECT 1FROM TableWHERE COURIERCODE = t.COURIERCODEAND WAYBILLSTARTSERIES <> WAYBILLENDSERIES)[/code]------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
 |
|
rajnidas
Yak Posting Veteran
97 Posts |
Posted - 2014-08-02 : 06:25:06
|
thanks and hats off to youyou resolved my query problem.thanksrajnidas |
 |
|
|
|
|
|
|