From: | Steve Meynell <steve(at)candata(dot)com> |
---|---|
To: | Joel Burton <jburton(at)scw(dot)org> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: Selecting Most Recent Row |
Date: | 2000-12-13 22:09:14 |
Message-ID: | 3A37F38A.D52497C0@candata.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Joel,
Thank you very much. I gave that a try and it worked perfectly. It
definately was the distinct keyword I was missing.
Thanks Again,
Steve
Joel Burton wrote:
>
> Will DateStamp being the date of insertion? If so, is it that you want
> the record for the most recent (largest) datestamp for each
> batch_number?
>
> something like
>
> SELECT DISTINCT ON (batch_number) unique_key, datestamp,
> batch_number, instructions FROM widgets ORDER BY batch_number,
> datestamp desc;
>
> (sort by batch then by date (last first) and show the first (aka
> 'distinct') row, considering only the batch_number for distinctness)
From | Date | Subject | |
---|---|---|---|
Next Message | clayton cottingham | 2000-12-13 22:16:08 | Re: How to represent a tree-structure in a relational database |
Previous Message | Joel Burton | 2000-12-13 21:38:23 | Re: Selecting Most Recent Row |