Thread: Re: difficult query (fwd)

Re: difficult query (fwd)

From
Jakub Ouhrabka
Date:
> 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