Reputation: 3189
I have two tables, one is "stores" table, and the other one is "products" table.
Stores table:
-------------
| id | desc |
-------------
| 1 | st1 |
| 2 | st2 |
| 3 | st3 |
Products table:
-------------
| id | desc |
-------------
| 1 | pr1 |
| 2 | pr2 |
| 3 | pr3 |
I want to select all "stores", and all "products" with each store like that:
Result:
---------------------
| stores | products |
---------------------
| st1 | pr1 |
| st1 | pr2 |
| st1 | pr3 |
| st2 | pr1 |
| st2 | pr2 |
| st2 | pr3 |
| st3 | pr1 |
| st3 | pr2 |
| st3 | pr3 |
Is that possible?
Upvotes: 0
Views: 576
Reputation: 966
You can use Cross Join like below:
select stores.desc,products.desc from stores cross join products
Upvotes: 1
Reputation: 7788
You can do: SELECT Stores.desc AS stores, Products.desc AS products FROM Stores, Products
Upvotes: 1