Received: from localhost.localdomain (postgresql.org [64.49.215.8]) by localhost (Postfix) with ESMTP id 4B30E475DFC for ; Sat, 4 May 2002 15:23:11 -0400 (EDT) Received: from ss1000.ms.mff.cuni.cz (ss1000.ms.mff.cuni.cz [195.113.19.221]) by postgresql.org (Postfix) with ESMTP id DF583475C17 for ; Sat, 4 May 2002 15:21:36 -0400 (EDT) Received: from u-pl2.ms.mff.cuni.cz (u-pl2.ms.mff.cuni.cz [195.113.21.162]) by ss1000.ms.mff.cuni.cz (Postfix) with ESMTP id 991301CFB1; Sat, 4 May 2002 21:21:36 +0200 (CEST) Received: by u-pl2.ms.mff.cuni.cz (Postfix, from userid 18664) id BB633CD02; Sat, 4 May 2002 21:21:34 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by u-pl2.ms.mff.cuni.cz (Postfix) with ESMTP id B7B6ACCD5; Sat, 4 May 2002 21:21:34 +0200 (CEST) Date: Sat, 4 May 2002 21:21:34 +0200 (CEST) From: Jakub Ouhrabka X-X-Sender: To: Ian Barwick Cc: Subject: Re: difficult query (fwd) In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Archive-Number: 200205/30 X-Sequence-Number: 7666 > 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