Re: Query Assistance

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: Query Assistance
Дата
Msg-id 476042C1.8070707@archonet.com
обсуждение исходный текст
Ответ на Re: Query Assistance  ("Gary Chambers" <gwchamb@gmail.com>)
Список pgsql-sql
Gary Chambers wrote:
> D'Arcy...
> 
>> Have you considered this?
> 
> I considered integrating the begin and end times into the table.  I'm
> capturing the data via ACPI events, so it's "transactional" by nature.
> I want to be able to keep track of false transitions (hence the
> is_outage field).
> 
> I'm looking for a way to simplify the transitions output on my web
> browser, and I want to combine an offline and a corresponding online
> time into a single line.

How about a "paired_with" field that references the power_transitions 
table and a trigger. When you insert a new row, it checks what the 
previous row was - if it's a down & this is an up, then set the 
paired_with field on each.

--   Richard Huxton  Archonet Ltd


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

Предыдущее
От: "Rodrigo De León"
Дата:
Сообщение: Re: Query design assistance - getting daily totals
Следующее
От: "Rolf A. de By"
Дата:
Сообщение: Trigger definition . . . puzzled