这是我的表
table_datetime1
2018-03-01 00:05:00
2018-03-01 00:10:00
2018-03-01 00:15:00
2018-03-01 00:20:00
2018-03-01 00:25:00
table_datetime2
2018-03-01 00:05:00
2018-03-01 00:10:00
2018-03-01 00:15:00
2018-03-01 00:20:00
2018-03-01 00:30:00
在这种情况下,2条记录不是,我想在查询中向我显示那2条记录
example
2018-03-01 00:25:00
2018-03-01 00:30:00
答案 0 :(得分:0)
这应该给你两个记录:
select * from table1 a
left join table2 b on b.table_datetime2 = a.table_datetime1
where b.table_datetime2 is null
union
select * from table2 a
left join table1 b on b.table_datetime1 = a.table_datetime2
where b.table_datetime1 is null