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 7331CD1C4EB for ; Tue, 9 Mar 2004 13:05:23 +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 18033-05 for ; Tue, 9 Mar 2004 09:05:23 -0400 (AST) Received: from localhost.localdomain (unknown [200.245.23.5]) by svr1.postgresql.org (Postfix) with ESMTP id 19441D1BB5F for ; Tue, 9 Mar 2004 09:05:13 -0400 (AST) Received: from yahoo.com.br (localhost.localdomain [127.0.0.1]) by localhost.localdomain (8.12.8/8.12.8) with ESMTP id i29DEiGq002082; Tue, 9 Mar 2004 10:14:45 -0300 Message-ID: <404DC344.4070209@yahoo.com.br> Date: Tue, 09 Mar 2004 10:14:44 -0300 From: Daniel Henrique Alves Lima Reply-To: email_daniel_h@yahoo.com.br User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030624 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Tom Lane Cc: pgsql-sql@postgresql.org Subject: Re: Help to simplify sample query References: <404D5920.40104@yahoo.com.br> <21339.1078813653@sss.pgh.pa.us> In-Reply-To: <21339.1078813653@sss.pgh.pa.us> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200403/78 X-Sequence-Number: 17177 How about this: select cd_area from area a1 where not exists ((select 1,2 union select 98,45 union select 11,0) except select c2.cd_teacher,c2.cd_course from teacher_course c2 where c2.cd_course=a1.course) ? Tom Lane wrote: >Daniel Henrique Alves Lima writes: > > >> I don't think this is possible, but: Is there a efficient way to >>compare if the result of a query is a superset of the result of another ? >> >> > >Perhaps do "SELECT foo EXCEPT SELECT bar" and see if you get anything? > > regards, tom lane > > >