I’m loading test data, and have a situation where I have a list of ID’s I need to generate test-data for, and a list of sample data I’d like to populate for each test ID. Something like this:
TestIDs
———
1
2
3TestData
——–
A
B
What I want is a join that produces:
Result
——–
1 A
1 B
2 A
2 B
3 A
3 B
This is essentially a join without an “on” clause, however the trick in SQL is that the “join” keyword isn’t needed either. The select statement is simply:
select * from TestIDs, TestData
Notice that there is a comma seperating the tables to select from, and no join keyword anywhere. Handy!
Leave a Reply