答案 0 :(得分:1)
使用between
删除指定日期之间的行:
DELETE FROM date1
WHERE (date BETWEEN '01/26/2015' AND '01/27/2015')
现在2015年1月21日以外的值将被删除:
使用select
查询来查看结果。
输出: 01/21/2015
答案 1 :(得分:0)
试试格式:
DELETE FROM table WHERE date = '2015-01-21'
或
DELETE FROM table WHERE date > '2015-01-20' AND date < '2015-01-22';
也许日期不完全是'2015-01-21'。
答案 2 :(得分:0)
如果您只想显示,请在选择
中使用NOT EXISTS()
SELECT Date FROM Dates d
WHERE NOT EXISTS(SELECT * FROM DateRange WHERE d.Date BETWEEN StartDate AND EndDate)
如果您需要删除记录
DELETE FROM Dates d
WHERE EXISTS(SELECT * FROM DateRange WHERE d.Date BETWEEN StartDate AND EndDate)
答案 3 :(得分:0)
DELETE FROM tableName WHERE date BETWEEN '01/26/2015' AND '01/27/2015'