pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Robby Slaughter <webmaster@robbyslaughter.com>
To: Mark Mikulec <mm98au@badger.ac.brocku.ca>
To: pgsql-sql@postgresql.org
Subject: RE: Sequential select queries...??
Date: Mon, 20 Aug 2001 11:35:00 -0500
Message-ID: <EPEHLKLEHAHLONFOKNHNGEPKDEAA.webmaster@robbyslaughter.com> (raw)
In-Reply-To: <3B79C512.9F6E09B7@badger.ac.brocku.ca>

>Hello,

>At first I thought what I was trying to do was simple and could be done
>easily - but alas, I've spent way too much time and could not figure out
>how to get the results in question.

I think there's cause for excitement, because unless I'm interpreting you
incorrectly, it IS easy to do what you want to do:

Use the UNION functionality. If your table T is this

  id   name   description
 -------------------------
   1   abc       def
   2   bcd       abc
   3   def       ghi
   4   jkl       bcd
   5   hij       hij

And you do this:

  SELECT id FROM T WHERE name = 'abc' 
     UNION
  SELECT id FROM T WHERE desc = 'abc';

You'll get:

   id
  ----
    1
    2

That ought to do it for you!

Hope this helps,
Robby Slaughter



view thread (7+ messages)  latest in thread

Message-ID: <EPEHLKLEHAHLONFOKNHNGEPKDEAA.webmaster@robbyslaughter.com>
Permalink:  ../EPEHLKLEHAHLONFOKNHNGEPKDEAA.webmaster@robbyslaughter.com/
Also on:    postgresql.org/message-id/EPEHLKLEHAHLONFOKNHNGEPKDEAA.webmaster@robbyslaughter.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: webmaster@robbyslaughter.com, mm98au@badger.ac.brocku.ca
  Subject: RE: Sequential select queries...??
  In-Reply-To: <EPEHLKLEHAHLONFOKNHNGEPKDEAA.webmaster@robbyslaughter.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