X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 24757D1B591 for ; Thu, 23 Oct 2003 19:53:51 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 24338-03 for ; Thu, 23 Oct 2003 16:53:20 -0300 (ADT) Received: from imo-d02.mx.aol.com (imo-d02.mx.aol.com [205.188.157.34]) by svr1.postgresql.org (Postfix) with ESMTP id E3516D1B991 for ; Thu, 23 Oct 2003 16:44:49 -0300 (ADT) Received: from yusuf0478@netscape.net by imo-d02.mx.aol.com (mail_out_v36_r1.1.) id k.1a.b046337 (16239) for ; Thu, 23 Oct 2003 15:44:43 -0400 (EDT) Received: from netscape.net (mow-m03.webmail.aol.com [64.12.184.131]) by air-in03.mx.aol.com (v96.8) with ESMTP id MAILININ33-3f6f3f982faa37a; Thu, 23 Oct 2003 15:44:42 -0400 Date: Thu, 23 Oct 2003 15:44:42 -0400 From: yusuf0478@netscape.net To: pgsql-sql@postgresql.org Subject: Re: Query Help MIME-Version: 1.0 Message-ID: <2B89351F.1780E21D.037EC703@netscape.net> X-Mailer: Atlas Mailer 2.0 X-AOL-IP: 66.163.11.108 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=1.9 tagged_above=0.0 required=5.0 tests=EMAIL_ATTRIBUTION, FREE_TRIAL, FROM_ENDS_IN_NUMS, MAILTO_TO_SPAM_ADDR, NO_REAL_NAME X-Spam-Level: * X-Archive-Number: 200310/317 X-Sequence-Number: 15717 Wouldn't that return every A.id ? since A.id would be compared to -1, and the wouldnt' be the same. I want: select min(A.id) such that A.charge, B.userid, C.employee_id in ( select A.charge , B.user_id , C.employee_id from A inner join B using (user_id) inner join C using (employee_id) except select X.charge , Y.user_id , Z.employee_id from X inner join Y using (user_id) inner join Z using (employee_id) ) "scott.marlowe" wrote: >On Thu, 23 Oct 2003 yusuf0478@netscape.net wrote: > >> I'm interested in finding the minimim A.id such that the following holds: >> >> select A.charge >> , B.user_id >> , C.employee_id >> from A >> inner join B using (user_id) >> inner join C using (employee_id) >> >> except >> >> select X.charge >> , Y.user_id >> , Z.employee_id >> from X >> inner join Y using (user_id) >> inner join Z using (employee_id) >> >> -- >> >> I can't do the following, since the number of selected columns have to match: >> >> select A.id >> , A.charge >> , B.user_id >> , C.employee_id >> from A >> inner join B using (user_id) >> inner join C using (employee_id) >> >> except >> >> select X.charge >> , Y.user_id >> , Z.employee_id >> from X >> inner join Y using (user_id) >> inner join Z using (employee_id) > >Maybe you can add a dummy field in the second half like this: > >except > > select -1 > , X.charge > , Y.user_id > , Z.employee_id > >??? > > >---------------------------(end of broadcast)--------------------------- >TIP 6: Have you searched our list archives? > > http://archives.postgresql.org > __________________________________________________________________ McAfee VirusScan Online from the Netscape Network. Comprehensive protection for your entire computer. Get your free trial today! http://channels.netscape.com/ns/computing/mcafee/index.jsp?promo=393397 Get AOL Instant Messenger 5.1 free of charge. Download Now! http://aim.aol.com/aimnew/Aim/register.adp?promo=380455