August 1, 2008 at 7:21 am
I am needing to join two tables and then creating all possible combinations from that data.
any help is greatly appreciated.
Thanks
August 1, 2008 at 7:23 am
Sounds like you need to use 'CROSS JOIN'...
http://technet.microsoft.com/en-us/library/ms190690.aspx
Ryan Randall
Solutions are easy. Understanding the problem, now, that's the hard part.
August 1, 2008 at 7:55 am
anyone have an example of this?
I need to take two tables, two columns and have it output a third with all possible combinations.
August 1, 2008 at 8:05 am
Your google not working?
select *, fName + ' ' + lName as FullName from
(
select 'Fred' as fName union
select 'Wilma' union
select 'Barney' union
select 'Betty'
) as flintstones_1 CROSS JOIN
(
select 'Flintstone' as lName union
select 'Rubble'
) as flintstones_2
This was my starting point:
http://www.sqlservercentral.com/articles/Advanced+Querying/jointestdata/197/
Ryan Randall
Solutions are easy. Understanding the problem, now, that's the hard part.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply