Received: from beamish.nsd.ca (unknown [205.150.156.194]) by postgresql.org (Postfix) with ESMTP id 8EE0F475A69 for ; Thu, 21 Feb 2002 16:59:54 -0500 (EST) Received: (from smap@localhost) by beamish.nsd.ca (8.9.3/8.9.3) id QAA06973; Thu, 21 Feb 2002 16:59:51 -0500 X-Authentication-Warning: beamish.nsd.ca: smap set sender to using -f Received: from reddog.nsd.ca(192.168.101.30) by beamish.nsd.ca via smap (V2.1/2.1+anti-relay+anti-spam) id xma006969; Thu, 21 Feb 02 16:59:25 -0500 Received: from nsd.ca (jllachan-linux.nsd.ca [192.168.101.148]) by reddog.nsd.ca (8.8.7/8.8.7) with ESMTP id RAA24221; Thu, 21 Feb 2002 17:00:53 -0500 Message-ID: <3C757008.563010AF@nsd.ca> Date: Thu, 21 Feb 2002 17:09:12 -0500 From: Jean-Luc Lachance X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.4.9-12 i686) X-Accept-Language: en MIME-Version: 1.0 To: "D'laila Pereira" Cc: pgsql-sql@postgresql.org Subject: Re: SQL query (general) References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Archive-Number: 200202/294 X-Sequence-Number: 6717 Why don't you write in words what you are trying to accomplish. To me, it looks like the query should be: select * from R where a2 > a1; D'laila Pereira wrote: > > i have the following table R > id a1 a2 > 1 A B > 2 A B > 3 B C > 4 C A > 5 B C > > and to write q uery thats outputs the following > id a1 a2 > 1 A B > 2 A B > 3 B C > 5 B C > > Is the following query correct? > select * > from (select * > from R > groupby a1) as T1, > (select * > from R > groupby a1) as T2, > where T1.id<>T2.id > AND T1.a1=T2.a1 > AND T1.a2=T2.a2; > > please correct. > > ---------------------------(end of broadcast)--------------------------- > TIP 6: Have you searched our list archives? > > http://archives.postgresql.org