riggs riggs - 3 months ago 9
SQL Question

SQL(MSSQL) Query: Pair each record from table 1 to all record at table 2

Guys am having a hard time searching for this, i just can't properly write it in words.. but it's like this. attached image -->
MY PROBLEM

qxg qxg
Answer

You need a CROSS JOIN.

SELECT TABLE1.BAKESHOP_NO, TABLE2.PRODUCT_NO
FROM TABLE1 CROSS JOIN TABLE2
ORDER BY BAKESHOP_NO, PRODUCT_NO