Posted by Ed Murphy on 05/14/07 09:45
Gooseman wrote:
> I have a query which works for one day:
>
> SELECT SOME_COL AS something, SOME_COL2 AS something2 FROM myTable
> WHERE DATE = '2007-05-11' AND SOME_STAT > 1
>
> Returns
>
> something something 2
> 1 2
> 3 4
>
> How do I get this to work for a date range (e.g. DATE > '2007-05-09')
> where I get:
>
> date something something2
> 2007-05-09 1 2
> 2007-05-09 3 4
> 2007-05-10 1 2
> 2007-05-10 3 4
> 2007-05-11 1 2
> 2007-05-11 3 4
I think the usual method is to create a table containing all dates
that you're likely to ever use, then cross-join to it.
[Back to original message]
|