Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1Tm5k2-0006HU-1S for pgsql-sql@arkaria.postgresql.org; Fri, 21 Dec 2012 16:46:34 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1Tm5k1-0003Jn-4d for pgsql-sql@arkaria.postgresql.org; Fri, 21 Dec 2012 16:46:33 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1Tm5k0-0003Ji-Cx for pgsql-sql@postgresql.org; Fri, 21 Dec 2012 16:46:32 +0000 Received: from nm7-vm0.bullet.mail.bf1.yahoo.com ([98.139.213.151]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1Tm5jx-0006pj-Ui for pgsql-sql@postgresql.org; Fri, 21 Dec 2012 16:46:31 +0000 Received: from [98.139.215.141] by nm7.bullet.mail.bf1.yahoo.com with NNFMP; 21 Dec 2012 16:46:28 -0000 Received: from [76.13.13.43] by tm12.bullet.mail.bf1.yahoo.com with NNFMP; 21 Dec 2012 16:46:28 -0000 Received: from [127.0.0.1] by smtp104.prem.mail.ac4.yahoo.com with NNFMP; 21 Dec 2012 16:46:28 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1356108388; bh=1SFZB56JxDp/7w/yy6/30xPvu9nRlW4CZG7Twv59iSY=; h=X-Yahoo-Newman-Id:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:Received:From:To:References:In-Reply-To:Subject:Date:Message-ID:MIME-Version:Content-Type:X-Mailer:Thread-Index:Content-Language; b=VgLCzL2JEGTeEMrzyLNIgwe5GSdj6aUYeeXeH5cH+NB5Cn6H2uKi8KwIK7zS7vNbPkT6jkftSSCi/U/8A4pFNVeTD9MYU150ByL7SiDGgl4pE0ijN8uTt2RV1mq6azWFBPxCdSXeYAxEOoWBZ/ySikaWlYkMPcX4QNFsVo+93bk= X-Yahoo-Newman-Id: 330095.21385.bm@smtp104.prem.mail.ac4.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: jQKvrPIVM1mgLPbKpWbwOkvg6sXu9Y4dwwa8LjX3ujLO5oe WyQGWqnb_XyVHvMjeSul.Gia4NDHYuZbKNHTc74rNPiShS1IoOPV3jyh2Qqb IqwZSfg_zlTYOCfETq5DvN1g2OxiRwBGV9SoQpLIjA4dm294x8bN1Op3z2JD 6jRkJ07tTMrrDgZKkMHpKo3UHW_ORwLtIYCAWFZSLSraNOuXBRFg1SZwyNQO jrKKXxdpmvgG3vAb4s3IWU0JJofqMvzLbczltcEAYblSwgeicfCyuhOWQ5Dj ZVBXIG1XXyvAOYoIS9bRSUTumEW3MSE77NZ4xHmvtQzfoeQu1OrbDhnPJUhc nFeTBQV291Wdn1AYkOTeARytlR49QV8mne2MF4iTJJDUl5drt195FVx42Yv5 3ghvJZJSo4WuFLPDa7q9xEFGVXYf2qBQjBivsFiq4yJiH_sW71Nv92Fbmi0U dwGI- X-Yahoo-SMTP: mpGJl6eswBD2IBufoVEg0Pa8gg-- Received: from WolfDog (polobo@24.93.28.86 with login) by smtp104.prem.mail.ac4.yahoo.com with SMTP; 21 Dec 2012 08:46:28 -0800 PST From: "David Johnston" To: "'Wes James'" , References: In-Reply-To: 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> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_00A3_01CDDF70.CD92BED0" X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQLTC2sz5SuDzUw20HOStdp3nuWRpZYZHlmA Content-Language: en-us X-Pg-Spam-Score: 0.7 (/) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-sql Precedence: bulk Sender: pgsql-sql-owner@postgresql.org This is a multipart message in MIME format. ------=_NextPart_000_00A3_01CDDF70.CD92BED0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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. ------=_NextPart_000_00A3_01CDDF70.CD92BED0 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

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.

 

------=_NextPart_000_00A3_01CDDF70.CD92BED0--