Re: difficult query (fwd) - Mailing list pgsql-sql

From Jakub Ouhrabka
Subject Re: difficult query (fwd)
Date
Msg-id Pine.LNX.4.33.0205042104480.19063-100000@u-pl2
Whole thread Raw
List pgsql-sql
> 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=2
>  UNION
> SELECT 3, COUNT(data) FROM table1 WHERE day=3
>  UNION
> SELECT 4, COUNT(data) FROM table1 WHERE day=4
>
> (and so on ad infinitum)

yeah, i was thinking about something like this and thought it can't be
correct because it would be infinite. but now i realized that it isn't
really infinite, it's just maxint unions, perfectly finite :) maybe it's
this what was mention as a curiosity on that sql course... very ugly ;)
and it would be even uglier when you use it as a from clause for
select limiting the result to be in min(day)..max(day) range... really
funny...

thanks,           kuba



pgsql-sql by date:

Previous
From: Joseph Barillari
Date:
Subject: Re: Syntax error in plpgsql crashes backend
Next
From: Joseph Barillari
Date:
Subject: More long-string woes