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 |
|
pravin14u
Posting Yak Master
246 Posts |
Posted - 2008-01-14 : 03:09:36
|
| Hi,I have a table with 2 columns (S.No,Name) with rows1,Raja2,Ramu3,RaneI need to generate all 2 pair combinations of the names(i,e)(Raja -Ramu)(Raja -Rane)(Ramu -Rane)Can some one give me a generalized query for this problem?Thanks,Prakash.P |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-01-14 : 03:31:25
|
CROSS JOIN with inequality filter.SELECT t1.Name, t2.NameFROM Table1 AS t1CROSS JOIN Table1 AS t2WHERE t1.Sno < t1.Sno E 12°55'05.25"N 56°04'39.16" |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-01-14 : 03:31:48
|
This is also known as "triangular join". E 12°55'05.25"N 56°04'39.16" |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-01-14 : 03:37:53
|
quote: Originally posted by Peso CROSS JOIN with inequality filter.SELECT t1.Name, t2.NameFROM Table1 AS t1CROSS JOIN Table1 AS t2WHERE t1.Sno < t2.Sno E 12°55'05.25"N 56°04'39.16"
MadhivananFailing to plan is Planning to fail |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-01-14 : 04:34:27
|
Thank you. E 12°55'05.25"N 56°04'39.16" |
 |
|
|
|
|
|