Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 8684D9FA333 for ; Mon, 6 Nov 2006 15:54:48 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 31836-03 for ; Mon, 6 Nov 2006 15:54:44 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from web31808.mail.mud.yahoo.com (web31808.mail.mud.yahoo.com [68.142.207.71]) by postgresql.org (Postfix) with SMTP id 51E8B9FA1DB for ; Mon, 6 Nov 2006 15:54:44 -0400 (AST) Received: (qmail 42369 invoked by uid 60001); 6 Nov 2006 19:54:43 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-ID; b=DXXgTO8vnnhcDB/k/S1MZbnA1AuaN4YrrpB1vyy39gkUv7bZFZHqg4W6utLKqAXVtrW3mLtB4Ttix1pYTP1+09OMt67dbW8k1HzLvo1k+RWvZDSnXoE+fLhmshWQhew1/HdyYElvVJBh4CAKKPXeKgjnc51G5r4ybkOyxmKEBsg= ; X-YMail-OSG: XpkKFaIVM1ml77bjxVOAJNIOV1Ip6QCQ_AxvPpBc Received: from [12.177.97.50] by web31808.mail.mud.yahoo.com via HTTP; Mon, 06 Nov 2006 11:54:42 PST Date: Mon, 6 Nov 2006 11:54:42 -0800 (PST) From: Richard Broersma Jr Subject: Re: a celko-puzzle from long time ago To: stig erikson , pgsql-sql@postgresql.org In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Message-ID: <73540.41726.qm@web31808.mail.mud.yahoo.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.468 tagged_above=0 required=5 tests=AWL, BAYES_00, DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST, DNS_FROM_RFC_WHOIS X-Spam-Level: X-Archive-Number: 200611/83 X-Sequence-Number: 26735 > 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? I believe that qty is a parameter variable that must first be set in psql. I've seen some thread in various lists that describe how to set parameter variables before executing a query that uses them. Regards, Richard Broersma Jr.