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 |
|
Manothinakaran
Starting Member
8 Posts |
Posted - 2010-11-15 : 00:21:33
|
| Dear Guru,I need a huge favour.I have a table with column siteidData as follows for table sites:A,B,CI need to create a view with 2 columns Origin Site, Destination Site.I need to get all the combination for column siteid.For an example as below:A - BA - CB - CI do not want combination as below:A - AB - AB - BC - CC - BCan anyone help me on this? |
|
|
Sachin.Nand
2937 Posts |
Posted - 2010-11-15 : 04:12:37
|
| [code]declare @tbl table(site varchar(10))insert @tblselect 'A' unionselect 'B' unionselect 'C' select * from(select t1.site ,t2.site site1 from @tbl t1 cross join @tbl t2)T where site1>site[/code]PBUH |
 |
|
|
Manothinakaran
Starting Member
8 Posts |
Posted - 2010-11-22 : 22:04:58
|
quote: Originally posted by Sachin.Nand
declare @tbl table(site varchar(10))insert @tblselect 'A' unionselect 'B' unionselect 'C' select * from(select t1.site ,t2.site site1 from @tbl t1 cross join @tbl t2)T where site1>site PBUH
Dear Guru,So sorry for the late reply. Thank you sooo much for the help. Really appreciate it alot...thank you soo much |
 |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
|
|
|