From: | Thomas Lockhart <thomas(at)fourpalms(dot)org> |
---|---|
To: | Fraser Murray <frasernm(at)yahoo(dot)co(dot)uk> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Generating a list of days |
Date: | 2002-03-20 15:59:04 |
Message-ID: | 3C98B1C8.3B65AEA6@fourpalms.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
> I'm trying to generate a list of days between a start
> date and an end date for use in a query - I would then
> do an outer join with some other data for graphing
> purposes as I need all the days with 0 entries.
istm that you would be able to simply qualify your query with a
WHERE your_date_column BETWEEN 'your_start_date" AND 'your_end_date'
You can use GROUP BY/HAVING to get missing results, or just select on
the NULL columns in the outer join you have already suggested.
If you put the date column in the output also then you would have the
list available at that point.
If you are using perl and actually want a complete list of the *missing*
dates, which is of course what you said you wanted, I would suggest
doing the above query (which can be efficient) and then generate the
list of missing dates using perl (which is also efficient generating a
list).
Folks may have other good suggestions too...
hth
- Thomas
From | Date | Subject | |
---|---|---|---|
Next Message | Ian Harding | 2002-03-20 15:59:48 | Re: SQL Server performing much better?!?! |
Previous Message | Jeff Eckermann | 2002-03-20 15:57:54 | Re: How to create crude report with psql and/or plpgsql |