Re: Query help
От | Ron |
---|---|
Тема | Re: Query help |
Дата | |
Msg-id | 4742d501-9cff-fd59-b752-c7409354d39b@gmail.com обсуждение исходный текст |
Ответ на | Query help (Chuck Martin <clmartin@theombudsman.com>) |
Ответы |
Re: Query help
|
Список | pgsql-general |
On 1/26/19 5:04 PM, Chuck Martin wrote:
Does statuschange.insdatetime record when an ombcase record was first inserted, or when the status_fkey associated with ombcase.case_pkey was updated?
And why not add upddatetime to ombcase? That would solve all your problems.
I'm having trouble formulating a query. This is a simplified version of the tables:ombcase------------case_pkey integer, primary keycasename varcharinsdatetime timestamp w/o time zonestatus_fkey integer, foreign keystatus--------status_pkey integer, primary keystatusid varcharstatuschange--------statuschange_pkey integer, primary keyinsdatetime timestamp w/o time zoneombcase_fkey integer, foreign keyoldstatus_fkey integer, foreign keynewstatus_fkey integer, foreign keyactive integer, not nullableThe idea should be obvious, but to explain, insdatetime is set when a new record is created in any table. All records in ombcase have a foreign key to status that can't be null. When status changes, a record is created in statuschange recording the old and new status keys, and the time (etc).The goal is to find records in ombcase that have not had a status change in xx days. If the status has not changed, there will be no statuschange record.
Does statuschange.insdatetime record when an ombcase record was first inserted, or when the status_fkey associated with ombcase.case_pkey was updated?
And why not add upddatetime to ombcase? That would solve all your problems.
--
Angular momentum makes the world go 'round.
Angular momentum makes the world go 'round.
В списке pgsql-general по дате отправления: