pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: D'laila Pereira <dlailap@home.com>
To: pgsql-sql@postgresql.org
Subject: SQL query (general)
Date: Tue, 19 Feb 2002 07:57:49 -0600
Message-ID: <eLsc8.20800$tg4.236195@vixen.cso.uiuc.edu> (raw)

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.





view thread (2+ messages)  latest in thread

Message-ID: <eLsc8.20800$tg4.236195@vixen.cso.uiuc.edu>
Permalink:  ../eLsc8.20800$tg4.236195@vixen.cso.uiuc.edu/
Also on:    postgresql.org/message-id/eLsc8.20800$tg4.236195@vixen.cso.uiuc.edu

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: dlailap@home.com
  Subject: Re: SQL query (general)
  In-Reply-To: <eLsc8.20800$tg4.236195@vixen.cso.uiuc.edu>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox