pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: msi77 <msi77@yandex.ru>
To: JORGE MALDONADO <jorgemal1960@gmail.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Query execution based on a condition
Date: Sat, 29 Dec 2012 23:36:56 +0400
Message-ID: <2795691356809816@web15e.yandex.ru> (raw)
In-Reply-To: <CAAY=A79=a3jPonSK9pHvVvS6QAFQdLZdKWAkkQj+bVdPB-GCNw@mail.gmail.com>
References: <CAAY=A79=a3jPonSK9pHvVvS6QAFQdLZdKWAkkQj+bVdPB-GCNw@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-sql>

Change the conditions of other 3 queries, so those shall give empty row sets depending on your value.

29.12.2012, 23:06, "JORGE MALDONADO" <jorgemal1960@gmail.com>:
> I have a query similar to the one shown below but, depending on the value of a field, only the first SELECT statement shoud execute and the other 3 should be ignored. Is there a way to achieve this situation?
>
> SELECT fields FROM tblTable WHERE condition
> UNION
>
> SELECT fields FROM tblTable WHERE condition
>
> UNION
>
> SELECT fields FROM tblTable WHERE condition
> UNION
>
> SELECT fields FROM tblTable WHERE condition
>
> Respectfully,
> Jorge Maldonado


-- 
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql



view thread (4+ messages)  latest in thread

Message-ID: <2795691356809816@web15e.yandex.ru>
Permalink:  ../2795691356809816@web15e.yandex.ru/
Also on:    postgresql.org/message-id/2795691356809816@web15e.yandex.ru

 · 

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: msi77@yandex.ru, jorgemal1960@gmail.com
  Subject: Re: Query execution based on a condition
  In-Reply-To: <2795691356809816@web15e.yandex.ru>

* 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