Re: help yourself by helping others

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: help yourself by helping others
Дата
Msg-id 200307100924.37218.dev@archonet.com
обсуждение исходный текст
Ответ на help yourself by helping others  ("Ali Adams" <aliadams@doit4u.com>)
Список pgsql-sql
On Friday 04 Apr 2003 12:10 pm, Ali Adams wrote:
> Dear All,
>
> I am new to Relational Databases and SQL and my background in ODBs is
> clouding my way to solving what seems to be a simple problem. I am sure
> many of you have met it many times.
>
> OK, I have a table as follows:
>
>
> ID Machine   Date             Withdrawals
> 1  1              01/01/2003    1101
> 2  2              01/01/2003    2101
> 3  3              01/01/2003    3101
[snip]
> And i would like to create a monthly withdrawals report as follows:
>
> Machine   Day1  Day2  Day3  Day4............ Day31

Two options - either do it in your app or write a crosstab function.

You can extract the day part of the month using: SELECT EXTRACT('day' FROM now());

You can find some crosstab functions in the contrib/tablefunc directory of the
source distribution (or possibly as a package if installed as binary)



--  Richard Huxton


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

Предыдущее
От: "David Witham"
Дата:
Сообщение: Re: trigger proceedures in sql
Следующее
От: Richard Huxton
Дата:
Сообщение: Re: trigger proceedures in sql