From: | Jason Friedman <jason(at)powerpull(dot)net> |
---|---|
To: | Brian Scandale <Brrrian(at)Excite(dot)com> |
Cc: | pgsql-novice(at)postgresql(dot)org |
Subject: | Re: last 25 records from a dataset |
Date: | 2002-07-07 02:57:41 |
Message-ID: | 20020707025741.K1034@abigail |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
I'm not a guru, but I have used a similar query successfully.
On 2002.07.06 23:48 Brian Scandale wrote:
> I am looking for the correct way to retrieve the last 25 records from
> a dataset without having to first retrieve the entire dataset to pull
> out the last 25.
>
> The potential dataset can be very large... 10,000 records that match
> the query... yet I only can use the most recent 25.
>
> my first idea is:
>
> SELECT *
> FROM table
> WHERE thisField=thatValue etc...
> ORDER BY table_id DESC
> LIMIT 25
>
> But I'm not confident in this and looking for a yeah or nay from a
> guru or two or three.
>
> Thanks,
> Brian
>
>
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>
>
From | Date | Subject | |
---|---|---|---|
Next Message | V R | 2002-07-07 09:58:23 | how to change rows to columns and vice versa? |
Previous Message | Brian Scandale | 2002-07-06 23:48:05 | last 25 records from a dataset |