From: | JT Kirkpatrick <jt-kirkpatrick(at)mpsllc(dot)com> |
---|---|
To: | "'pgsql-sql(at)hub(dot)org'" <pgsql-sql(at)hub(dot)org> |
Subject: | finding the most recent records |
Date: | 1999-04-30 14:31:06 |
Message-ID: | 01BE92F4.8E44C660.jt-kirkpatrick@mpsllc.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Mark Jewiss | 1999-04-30 14:55:45 | Re: [SQL] finding the most recent records |
Previous Message | JT Kirkpatrick | 1999-04-30 13:24:08 | RE: [SQL] time intervals |