Query Assistance
От | Gary Chambers |
---|---|
Тема | Query Assistance |
Дата | |
Msg-id | 302670f20712120858k210dd812l8b232ce98d5d162f@mail.gmail.com обсуждение исходный текст |
Ответы |
Re: Query Assistance
|
Список | pgsql-sql |
All... I have a simple table in PostgreSQL 8.2.5: CREATE TABLE power_transitions ( -- Transition ID (PK) tid integer NOT NULL, -- State ID (0 = Unknown, 1 = Online (ACpower), 2 = Offline (Battery) sid smallint NOT NULL, -- Timestamp of transition statetime timestamp without timezone DEFAULT now() NOT NULL, -- Is this a real outage? is_outage boolean DEFAULT true NOT NULL ); It contains a log of power outages (transitions). I'd like to create query that returns a transition offline time and associated return to online time. Is there a better way of handling this? I am open to schema change suggestions. Thanks very much! -- Gary Chambers // Nothing fancy and nothing Microsoft!
В списке pgsql-sql по дате отправления: