Reputation: 3829
I have been trying to write a query for a view but I can't seem to get it... I have two tables that I need to join... but what I need is that for every ID in table 1 I get all records on table 2. For Example:
Table 1 Table 2 Jhon Car Bill House Jet
I would like to get:
Table 3 Jhon Car Jhon House Jhon Jet Bill Car Bill House Bill Jet
P.S. Data on both tables can vary. P.S.S. Table 1 is actually a Left Outer Join between two other tables where the first table contains the indexes and the second contains the field used to create relation to Table 2.
Upvotes: 1
Views: 176
Reputation: 181
Try this
select * from table1, table2
or use a CROSS JOIN if database supports it
Upvotes: 3
Reputation: 452957
You need a CROSS JOIN
for this (AKA Cartesian Product).
SELECT t1.col, t2.col
FROM Table1 t1 cross join Table2 t2
Upvotes: 6