Re: Query design assistance - getting daily totals

Поиск
Список
Период
Сортировка
От A. Kretschmer
Тема Re: Query design assistance - getting daily totals
Дата
Msg-id 20071212063142.GA26523@a-kretschmer.de
обсуждение исходный текст
Ответ на Query design assistance - getting daily totals  (Paul Lambert <paul.lambert@reynolds.com.au>)
Ответы Re: Query design assistance - getting daily totals
Список pgsql-sql
am  Wed, dem 12.12.2007, um 10:34:35 +0900 mailte Paul Lambert folgendes:
> I have a table of account balances as at the end of a working day and 
> want to from that, calculate daily total figures.
> 
> Eg, let's say I have a table structure of:
> year_id integer
> month_id integer
> working_day integer

Why this broken data types? We have date and timestamp[tz].


> I suspect the second option would be more efficient than the first, and 
> probably easier to implement since it would be easier to handle 
> cross-month boundaries, i.e. day 1's daily total will be the amount on 
> that day minus the amount of the final day in the previous month - but 
> does anyone have any alternate suggestions that would be better still?

Yes, i would also write a similar function. And if you have proper
datatypes it would be simpler to calculate the previous date and you can
use a proper index on the date column. 

Andreas
-- 
Andreas Kretschmer
Kontakt:  Heynitz: 035242/47150,   D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID:   0x3FFF606C, privat 0x7F4584DA   http://wwwkeys.de.pgp.net


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

Предыдущее
От: Paul Lambert
Дата:
Сообщение: Re: Function result using execute
Следующее
От: Paul Lambert
Дата:
Сообщение: Re: Query design assistance - getting daily totals