【发布时间】:2018-12-31 08:57:55
【问题描述】:
我正在尝试从“注册”表中返回满足闭包表中的行指定的所有日期范围的所有行。以下查询返回闭包表的相应第一行的寄存器条目:
select * from Register where NOT(start_time > (select EndDate from Closures) OR start_time < (select StartDate from Closures)) group by id;
关闭表具有以下开始和结束日期:
"2018-09-21" "2018-09-27"
"2018-06-12" "2018-06-12"
"2018-06-10" "2018-06-12"
"2018-06-15" "2018-06-15"
"2018-06-19" "2018-06-24"
但是上面的查询只返回来自 Register 的行,就好像子查询返回 2018-09-21 和 2018-09-27,我如何让它基本上为子查询的所有行运行外部查询?
【问题讨论】:
标签: sql sqlite date-range