Say I have the following row in my table
table rows
id
63
64
65
66
67
68
If I run the following query, I get 30 lines.
SELECT r1.id, r2,id FROM rows AS r1 CROSS JOIN rows AS r2 WHERE r1.id!=r2.id
result:
63 64
65 64
66 64
67 64
68 64
64 63
65 63
66 63
67 63
68 63
63 65
64 65
66 65
67 65
68 65
63 66
64 66
65 66
67 66
68 66
63 67
64 67
65 67
66 67
68 67
63 68
64 68
65 68
66 68
67 68
how to get the following result instead of the above?
63.64
63.65
63.66
63.67
63.68
64.65
64.66
64.67
64.68
65.66
65.67
65.68
66.67
66.68
67.68
As you can see, I do not want to receive, for example, 63.64 and 64.63.
mysql cross-join
Moon
source share