finding the most recent records

Поиск
Список
Период
Сортировка
От JT Kirkpatrick
Тема finding the most recent records
Дата
Msg-id 01BE92F4.8E44C660.jt-kirkpatrick@mpsllc.com
обсуждение исходный текст
Ответы Re: [SQL] finding the most recent records
Re: [SQL] finding the most recent records
Список pgsql-sql
I didn't find who originally asked how to do this, but it IS possible to 
identify the most recent if you have a field in the table defined as 
"field1 datetime not null default text 'now'".  you'll only run into a 
problem if more than one record is inserted AT THE EXACT SAME SECOND -- but 
postgres will just put the same timestamp in there (don't define the field 
as unique).  I am putting this field (along with one that defaults to 
current_user) in ALL my tables for our application.  the values are input 
"behind the scenes" by default whenever anyone adds a record, and it gives 
me a simple little audit trail.  for instance, when that deceptive employee 
creates a "vendor" for himself and then creates a false purchase order and 
receipt thereby setting in motion a payment due to himself, i can see by 
whom and when the records were created.  hopefully i have other controls in 
place to prevent this from happening, but the point is that the timestamp 
works fine and can help you identify the most recent records!

jt


В списке pgsql-sql по дате отправления:

Предыдущее
От: JT Kirkpatrick
Дата:
Сообщение: RE: [SQL] time intervals
Следующее
От: Mark Jewiss
Дата:
Сообщение: Re: [SQL] finding the most recent records