X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 69F515E46D5 for ; Wed, 18 Aug 2004 00:42:27 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 78695-10 for ; Wed, 18 Aug 2004 03:42:29 +0000 (GMT) Received: from davinci.ethosmedia.com (server226.ethosmedia.com [209.128.84.226]) by svr1.postgresql.org (Postfix) with ESMTP id 3FCC55E46DF for ; Wed, 18 Aug 2004 00:42:18 -0300 (ADT) Received: from [63.195.55.98] (HELO spooky) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) with ESMTP id 6108171; Tue, 17 Aug 2004 20:43:40 -0700 Content-Type: text/plain; charset="iso-8859-1" From: Josh Berkus Organization: Aglio Database Solutions To: "Greg Sabino Mullane" , pgsql-sql@postgresql.org Subject: Re: SQL Challenge: Arbitrary Cross-tab Date: Tue, 17 Aug 2004 20:41:09 -0700 User-Agent: KMail/1.4.3 References: In-Reply-To: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-Id: <200408172041.09517.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200408/183 X-Sequence-Number: 18680 Greg, Stephan, > (SELECT tid FROM ats WHERE cid=bob.cid LIMIT 1 OFFSET 1) AS tk2, bzzzzz! Thanks for playing. LIMIT and OFFSET, sadly, are not SQL standard. They're only portable to MySQL. This has to port to SQL Server and Oracle. > If that works for 3 (and I think that's standard behavior), then you > should be able to extend it to any fixed number using the pattern. Hmmm... that might work. I'll have to test that the nesting doesn't kill SQL Server (a serious danger) but it's worth a try. Performance will really suck but fortunately we only run this bill once a month. -- Josh Berkus Aglio Database Solutions San Francisco