Received: from localhost (pluto.hub.org [200.46.204.4]) by postgresql.org (Postfix) with ESMTP id 9B6F49FA0FB for ; Sun, 5 Nov 2006 14:48:07 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.4]) (amavisd-new, port 10024) with ESMTP id 94726-08 for ; Sun, 5 Nov 2006 14:47:59 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) by postgresql.org (Postfix) with ESMTP id 0BBB79F9FE1 for ; Sun, 5 Nov 2006 14:48:06 -0400 (AST) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id F368630E21; Sun, 5 Nov 2006 19:48:05 +0100 (MET) From: stig erikson X-Newsgroups: pgsql.sql Subject: a celko-puzzle from long time ago Date: Sun, 05 Nov 2006 19:46:30 +0100 Organization: PYRENET Midi-pyrenees Provider Lines: 8 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@pyrenet.fr User-Agent: Thunderbird 1.5.0.7 (X11/20061008) To: pgsql-sql@postgresql.org X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200611/72 X-Sequence-Number: 26724 While reading celko's SQL puzzles (second edition) i followed a reference to http://www.dbmsmag.com/9801d06.html. There is a puzzle that counts items in boxes. When i try to run the proposed solution on PG 8.1.5, PG says: ERROR: column reference "qty" is ambiguous apparently the variable declaration used in the solution is not proper for PostgreSQL. Is there a way to solve this puzzle in PostgreSQL? /stig