3

I have query like this:

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;

it returns data for 1 selected date (type Date), but i want to get values from startDate to endDate, for example, i want to do it using one query which do something like that:

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;

It's possible?

1
  • 1
    yes... what type is d.date ? Commented Sep 14, 2011 at 8:51

1 Answer 1

4

... where d.date between '2011-09-01' and '2011-09-04' should work.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.