pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Fay Du <fay.du@versaterm.com>
To: pgsql-sql@postgresql.org
Subject: How can I selet rows which have 2 columns values cross equal?
Date: Fri, 10 Mar 2006 08:24:44 -0500
Message-ID: <001d01c64445$fec23350$b8d849c6@versaterm.com> (raw)

Hi All:
I have a table like this:

   Table test
Id   |  a | b
-----+----+---
1    | 100| 101
2    | 101| 100
3    | 100| 3
4    | 20 | 30
5    | 11 | 13
6    | 3  | 33
7    | 30 | 20

I want to get row 1, 2,4 and 7 selected. Because their values of a and b
are cross equal. i.e., for each pair of rows, 
a.Row1 = b.Row2 and b.Ro1 = a.Row2
a.Row4 = b.Row7 and b.Ro4 = a.Row7

How can I construct a sql statement to select them?
Thanks in advance.
Fay




view thread (6+ messages)  latest in thread

Message-ID: <001d01c64445$fec23350$b8d849c6@versaterm.com>
Permalink:  ../001d01c64445$fec23350$b8d849c6@versaterm.com/
Also on:    postgresql.org/message-id/001d01c64445$fec23350$b8d849c6@versaterm.com

 · 

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: fay.du@versaterm.com
  Subject: Re: How can I selet rows which have 2 columns values cross equal?
  In-Reply-To: <001d01c64445$fec23350$b8d849c6@versaterm.com>

* 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