pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: David Johnston <polobo@yahoo.com>
To: 'Wes James' <comptekki@gmail.com>
To: pgsql-sql@postgresql.org
Subject: Re: deciding on one of multiple results returned
Date: Fri, 21 Dec 2012 11:46:23 -0500
Message-ID: <00a201cddf9a$b667b560$23372020$@yahoo.com> (raw)
In-Reply-To: <CAFjCMHvbeLHRCMZJYd_ZXAEf1c_XdEsRwUth7x+LKzWCTPi0pw@mail.gmail.com>
References: <CAFjCMHvbeLHRCMZJYd_ZXAEf1c_XdEsRwUth7x+LKzWCTPi0pw@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-sql>

From: pgsql-sql-owner@postgresql.org [mailto:pgsql-sql-owner@postgresql.org]
On Behalf Of Wes James
Sent: Friday, December 21, 2012 11:32 AM
To: pgsql-sql@postgresql.org
Subject: [SQL] deciding on one of multiple results returned

 

If a query returns, say the following results:

id   value
0      a
0      b
0      c
1      a
1      b



How do I just choose a preferred element say value 'a' over any other
elements returned, that is the value returned is from a subquery to a larger
query?

Thanks.

 

 

ORDER BY 

 

(with a LIMIT depending on circumstances)

 

David J.

 

view thread (6+ messages)  latest in thread

Message-ID: <00a201cddf9a$b667b560$23372020$@yahoo.com>
Permalink:  ../00a201cddf9a$b667b560$23372020$@yahoo.com/
Also on:    postgresql.org/message-id/00a201cddf9a$b667b560$23372020$@yahoo.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: polobo@yahoo.com, comptekki@gmail.com
  Subject: Re: deciding on one of multiple results returned
  In-Reply-To: <00a201cddf9a$b667b560$23372020$@yahoo.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