September 11, 2005 at 7:49 pm
Hi, I have several combinations and I want to get all the possible combinations between them.
For example (note, this is not the tables i'm working with, it's just for giving an example):
SELECT weekday, seasons FROM weekdays CROSS JOIN seasons
would return
monday spring
monday summer
monday fall
...
tuesday spring
tuesday summer
...
sunday winter
With CROSS JOIN I get all possible combinations but always using a record from each table.
I want to get something like this:
null spring
null summer
...
monday null
monday spring
monday summer
...
tuesday null
tuesday spring
...
sunday winter
Please help me, it's urgent
September 11, 2005 at 7:55 pm
Select * from
(
Select null
union all
Select season from dbo.saisons
) dtNulls
cross join days
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy