我有 2 个基本表:
Table1
id1 | lastModif_date
1 10/10/10
2 10/10/10
3 10/10/10
和
Table2
id2 | lastModif_date
1 11/02/11
2 11/02/11
我想要一个返回的选择查询
id1 | id2 | lastModif_date
1 null 10/10/10
2 null 10/10/10
3 null 10/10/10
null 1 11/02/11
null 2 11/02/11
这一定很容易做到,但我无法理解......
最佳答案
select table1.id1, null as id2, table1.lastModif_date from table1
union all
select null, table2.id2, table2.lastModif_date from table2
关于mysql - 为 2 个表选择同一列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6733153/