MySQL cartesian product between two SELECT statements

前端 未结 5 1957
孤街浪徒
孤街浪徒 2020-12-03 12:16

I want to perform a cartesian product between two SELECT statements as

SELECT 1, 2     INNER JOIN     SELECT 3, 4 ;

I expect the result to

5条回答
  •  北荒
    北荒 (楼主)
    2020-12-03 12:49

    With the using this your format is not as you are saying A(1,2) and B(3,4) then the cross join will perform it like this:

    SELECT Table1.Col1, Table2.Col2
    FROM Table1
    CROSS JOIN Table2
    

    (A*B)= (1,3),(1,4),(2,3),(2,4)

提交回复
热议问题