| От | Steve Meynell |
|---|---|
| Тема | Re: Selecting Most Recent Row |
| Дата | |
| Msg-id | 3A37F38A.D52497C0@candata.com обсуждение исходный текст |
| Ответ на | Re: Selecting Most Recent Row ("Joel Burton" <jburton@scw.org>) |
| Список | 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)
В списке pgsql-sql по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера