From: | "D(dot)Sanchez" <dsanchezREMOVE(at)bigpond(dot)com> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: two dates |
Date: | 2003-03-16 22:37:55 |
Message-ID: | b52uc2$2b2j$1@news.hub.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
If you just want to select all entries created between two given dates, the
following query should do it:
SELECT column1, column2, ....
FROM table
WHERE creation_date between to_date('date1','date_format') and
to_date('date2','date_format')
order by creation_date;
This will find all the entries with a creation_date between date1 and date2
and it return the rows sorted by the creation date. You can add additional
selection critirias to the WHERE clause if needed.
David
"mixo" <mixo(at)beth(dot)uniforum(dot)org(dot)za> wrote in message
news:3E5B1349(dot)80705(at)beth(dot)uniforum(dot)org(dot)za(dot)(dot)(dot)
> I have a table which has serveral time stamps include when an entry was
> 'created'.
> Each entry is identified by a unique 'id'. How can I best find entries
> created
> between two dates without going through each day between the two dates?
>
> Currently, going through each day to get the results takes about 23
> minutes for 7 days
> as I have two other criteria for search: roughly I am doing about
> 16*17*n queries,
> where n=days between two dates (for 7 days, 16*17*7 = which a number
> that is
> too big for my liking).
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
From | Date | Subject | |
---|---|---|---|
Next Message | Objectz | 2003-03-17 08:01:10 | String aggregate function |
Previous Message | Joost Witteveen | 2003-03-15 23:53:32 | create index right after create table not working? |