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 BA879D1BA8F for ; Tue, 9 Mar 2004 12:41:58 +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 14351-05 for ; Tue, 9 Mar 2004 08:41:58 -0400 (AST) Received: from localhost.localdomain (unknown [200.245.23.5]) by svr1.postgresql.org (Postfix) with ESMTP id 4FA02D1BAC8 for ; Tue, 9 Mar 2004 08:41:48 -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 i29CpXGq001991; Tue, 9 Mar 2004 09:51:35 -0300 Message-ID: <404DBDD5.6090107@yahoo.com.br> Date: Tue, 09 Mar 2004 09:51:33 -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: Tomasz Myrta Cc: pgsql-sql@postgresql.org Subject: Re: Help to simplify sample query References: <404D5920.40104@yahoo.com.br> <404D6334.4030501@klaster.net> In-Reply-To: <404D6334.4030501@klaster.net> Content-Type: text/plain; charset=ISO-8859-2; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200403/77 X-Sequence-Number: 17176 Tomasz Myrta wrote: > > Can you try this query ? : > > select cd_area from area a1 > join teacher_course c2 using (cd_course) > where (cd_teacher,cd_course) in (select 1,2 union select 98,45 union > select 11,0); Tomasz, the "in" in the query above will work like an "or" ((cd_teacher=1,cd_course=2) or (cd_teacher=98,cd_course=45) or (cd_teacher=11,cd_course=0)) but i need an "and" behaviour (because of this i was using some exists/ands)... Thanks for your reply.