I have the follow query:
SELECT table1.data AS table1_data,
table2.data AS table2_data,
table3.data AS table3_data
FROM table1, table2, table3
GROUP BY table1.data, table2.data, table3.data
which results:
table1_data | table2_data | table3_data
------------------------------------------
2012-11-15 | 2012-11-18 | 2012-11-20
2012-11-16 | 2012-11-18 | 2012-11-23
2012-11-17 | 2012-11-18 | 2012-11-27
when I expect:
all_tables_data
----------------
2012-11-15
2012-11-16
2012-11-17
2012-11-18
2012-11-18
2012-11-18
2012-11-20
2012-11-23
2012-11-27
I have “googled” some terms but I can’t describe this type of query, so, nothing found which can help solve the problem.
you should use “UNION ALL” instead of “GROUP BY”: