Re: difficult query (fwd)

From: Jakub Ouhrabka <jouh8664(at)ss1000(dot)ms(dot)mff(dot)cuni(dot)cz>
To: Ian Barwick <barwick(at)gmx(dot)net>
Cc: <pgsql-sql(at)postgresql(dot)org>
Subject: Re: difficult query (fwd)
Date: 2002-05-04 19:21:34
Message-ID: Pine.LNX.4.33.0205042104480.19063-100000@u-pl2
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Browse pgsql-sql by date

  From Date Subject
Next Message Joseph Barillari 2002-05-04 20:57:54 More long-string woes
Previous Message Joseph Barillari 2002-05-04 18:44:21 Re: Syntax error in plpgsql crashes backend