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 |
|
jvst
Starting Member
12 Posts |
Posted - 2012-08-04 : 03:17:44
|
| i joined 3 tables, cC11 0 0 0 0 0 0 0 2 22 0 0 0 0 0 0 0 2 33 0 0 0 0 0 0 0 2 35 0 0 0 0 0 0 0 2 3C21 3 0 0 0 0 0 0 3 22 3 0 0 0 0 0 0 3 22 5 0 0 0 0 0 0 3 33 5 0 0 0 0 0 0 3 2and C32 3 5 0 0 0 0 0 4 2to create a table named FISETScreate table FISETS(item1 bigint, item2 bigint, item3 bigint, nullm bigint, count bigint)So FISETS now contains:ITEM1 ITEM2 ITEM3 ITEM4 ITEM5 ITEM6 ITEM7 ITEM8 NULLM COUNT1 0 0 0 0 0 0 0 2 22 0 0 0 0 0 0 0 2 33 0 0 0 0 0 0 0 2 35 0 0 0 0 0 0 0 2 31 3 0 0 0 0 0 0 3 22 3 0 0 0 0 0 0 3 22 5 0 0 0 0 0 0 3 33 5 0 0 0 0 0 0 3 22 3 5 0 0 0 0 0 4 2Now for each of the items in the FISETS, I need to generate the non-empty subsets. In other words (without "nullm" and "count" columns, I need each row to be paired up (joined?) with the other rows so i will come up with TITEM1 TITEM2 TITEM3 TITEM4 TITEM5 TITEM6 TITEM7 TITEM81 2 0 0 0 0 0 0 2 1 0 0 0 0 0 0 1 3 0 0 0 0 0 0 3 1 0 0 0 0 0 0 1 5 0 0 0 0 0 0 5 1 0 0 0 0 0 0 2 3 0 0 0 0 0 0 3 2 0 0 0 0 0 0 2 5 0 0 0 0 0 0 5 2 0 0 0 0 0 01 1 3 0 0 0 0 0:::and so on and so forth..can you join without condition? PLEASE, PLEASE HELP! Thank you.. |
|
|
jvst
Starting Member
12 Posts |
Posted - 2012-08-04 : 03:18:48
|
| By the way, the sequence is not important. |
 |
|
|
|
|
|