我想检查记录是否存在。
表格1:
S.No StartDate EndDate ————————————- 1. 2019-10-15 2019-10-20 2019-10-10 2019 -…
这个解决方案适用于我所有上述情况
SELECT * FROM Table1 WHERE ( StartDate <= 'date_from' and EndDate >= 'date_from' ) OR ( 'date_from' <= StartDate and 'date_to' >= StartDate ) OR ( StartDate < 'date_to' and EndDate >= 'date_to' )
参考:
用于搜索房间可用性的SQL查询