how to construct sql

Поиск
Список
Период
Сортировка
От Wes James
Тема how to construct sql
Дата
Msg-id AANLkTik3O3L0PLqy4SN5oHy9zSBf8TDLXzGZcPYLtEXf@mail.gmail.com
обсуждение исходный текст
Список pgsql-sql
I am grabbing a printer total and putting it in a table.  The
page_count is continuously increasing:

page_count_count        page_count_pdate
10                               2010-05-10
20                               2010-05-10
40                               2010-05-11
60                               2010-05-11
80                               2010-05-11
100                               2010-05-12
120                               2010-05-12
.....

and so on.

I can do:

select sum(page_count_count) from page_count group by page_count_pdate.

and get a total for a day.  But this is not the total I want.  I want
the total page count for the day.  This would mean getting the first
page count of the day and then subtracting that from last page_count
for the day.  For 2010-05-11 above it would be

80 - 40 = 40 total for the day.  Is there a way to do this with sql?

thx,

-wes


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

Предыдущее
От: Daniel Migowski
Дата:
Сообщение: Re: sorry, now with subject... trigger & nextval(seq)
Следующее
От: "Oliveiros"
Дата:
Сообщение: Re: how to construct sql