Re: difficult query

Поиск
Список
Период
Сортировка
От Ian Barwick
Тема Re: difficult query
Дата
Msg-id 200205042019.34265.barwick@gmx.net
обсуждение исходный текст
Ответ на Re: difficult query  (Jakub Ouhrabka <jouh8664@ss1000.ms.mff.cuni.cz>)
Ответы Re: difficult query  ("Joel Burton" <joel@joelburton.com>)
Список pgsql-sql
On Saturday 04 May 2002 19:34, Jakub Ouhrabka wrote:
> > > Is it possible to do this in sql?
> >
> > Basically, no. (You might be able to do it with the help
> > of a user-defined function though).
> >
> > Why do you want to do this?
>
> I'm curious. I've been on a sql course long time ago where the tutor
> mentioned similiar problem as something special for sql smarties...  And
> yesterday when I faced this problem (which can be solved perfectly with
> the outer join) I wasn't able to remember the solution... If there is
> any...  Just out of curiosity...

well, you could do it like this I suppose:

SELECT 1 AS day, COUNT(data) FROM table1 WHERE day=1 UNION
SELECT 2, COUNT(data) FROM table1 WHERE day=2UNION
SELECT 3, COUNT(data) FROM table1 WHERE day=3UNION
SELECT 4, COUNT(data) FROM table1 WHERE day=4

(and so on ad infinitum)

although I expect E.F. Codd will be turning in his grave ;-)

Ian Barwick



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

Предыдущее
От: Joseph Barillari
Дата:
Сообщение: Syntax error in plpgsql crashes backend
Следующее
От: Joseph Barillari
Дата:
Сообщение: Re: Syntax error in plpgsql crashes backend