MySQL – How to Generate All Combinations Between Two Columns

MySQL

table 1
|id|name  |
------------
|1 |Bob   |
|2 |Frank |
|3 |Paula |

Table 2
|id|item|
---------
|1 |a   |
|2 |b   |
|3 |c   |

i need to write a query to show me all the combinations of the two tables as below:

result
|name|item|
-----------
|bob |a   |
|bob |b   |
|bob |c   |
etc

I am currently using mysql any help would be greatly appreciated

Best Answer

This is called a cartesian product or a CROSS JOIN:

SELECT 
    a.name,  b.item 
FROM 
    table1 AS a 
  CROSS JOIN 
    table2 AS b;