December 7, 2006 at 8:07 am
Hi folks,
Say I have two tables.
Table A has records:
1
2
3
Table B has records:
A
B
C
I need a simple select query to get result:
1 A
1 B
1 C
2 A
2 B
2 C
3 A
3 B
3 C
Note there is no connection between the two tables, and I don't want to use cursor.
How to do this?
Thanks.
December 7, 2006 at 8:19 am
Could you use
SELECT * FROM TableA CROSS JOIN TableB
December 7, 2006 at 8:22 am
Thank you.
December 8, 2006 at 8:21 am
if you want that space you will have to do a cross join, with a + " " in the middle, otherwise with the statement of the person prior to me, you will get 1A, 1B, 1C etc not 1 A, 1 B, 1 C
Select Table1.value + " " + Table2.value FROM Table1 CROSS JOIN Table2;
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply