我有这样的查询:
select d.id from days as d JOIN tv_programs AS t ON (d.tv_program_id = t.id) WHERE d.date=? AND t.type=0 ORDER BY d.date, t.date DESC OFFSET 1;
它返回1个选定日期(类型日期)的数据,但我想从startDate到endDate获取值,例如,我想使用一个类似的查询来执行此操作:
select d.id from days as d JOIN tv_programs AS t ON (d.tv_program_id = t.id) WHERE d.date='2011-09-01' AND t.type=0 ORDER BY d.date, t.date DESC OFFSET 1;
select d.id from days as d JOIN tv_programs AS t ON (d.tv_program_id = t.id) WHERE d.date='2011-09-02' AND t.type=0 ORDER BY d.date, t.date DESC OFFSET 1;
select d.id from days as d JOIN tv_programs AS t ON (d.tv_program_id = t.id) WHERE d.date='2011-09-03' AND t.type=0 ORDER BY d.date, t.date DESC OFFSET 1;
有可能吗?
答案 0 :(得分:3)
... where d.date between '2011-09-01' and '2011-09-04'
应该有用。