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 |
|
paul_taylor2
Starting Member
1 Post |
Posted - 2011-02-17 : 17:17:44
|
| In Access, I've used this technique to create a table with all the possible combinations of two tables. i.e. one table has 12 records, one for each month. Another table has 100 records, one for each account. I put them together in a query and Access spits out a dataset of 1200 records. Each combination of account and month. I try to do this in MS SQL and my query gives no results.Is there a way to do this?P.S. I'm using RazorSQL to query the SQL Server db, because I couldn't get the client tools installed. |
|
|
nathans
Aged Yak Warrior
938 Posts |
Posted - 2011-02-17 : 17:33:21
|
I believe youre asking for a cartesian product of the two sets:declare @4 table (m int)insert into @4 select 1 union all select 2 union all select 3 union all select 4declare @2 table (i int)insert into @2 select 1 union all select 2-- will return 8 rows:select *from @4crossjoin @2 Nathan Skerl |
 |
|
|
|
|
|