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 |
nagarjuna_a2006
Starting Member
16 Posts |
Posted - 2014-11-02 : 08:17:22
|
I have below data SlNo Country1 India2 Pakistan3 Srilankai need a query that it should results Each country should play with other countryexpected o/p:Country CountryIndia PakistanIndia SrilankaSrilanka Pakistanoutput of the result set order is not important, i need the logic how to write it.Thanks in advanceRegards,Nagarjuna |
|
mole999
Starting Member
49 Posts |
|
nagarjuna_a2006
Starting Member
16 Posts |
Posted - 2014-11-02 : 09:02:29
|
if i user full outer join , result is showing as belowCountry CountryIndia IndiaPakistan PakistanSrilanka Srilankaplease suggest..Regards,Nagarjuna |
|
|
Ifor
Aged Yak Warrior
700 Posts |
Posted - 2014-11-03 : 07:44:59
|
[code]SELECT T1.Country, T2.CountryFROM YourTable T1 CROSS JOIN YourTable T2WHERE T1.SlNo < T2.SlNo;SELECT T1.Country, T2.CountryFROM YourTable T1 JOIN YourTable T2 ON T1.SlNo < T2.SlNo;-- etc[/code] |
|
|
nagarjuna_a2006
Starting Member
16 Posts |
Posted - 2014-11-03 : 23:42:56
|
Excellent,Thank you so much.Regards,Nagarjuna |
|
|
|
|
|