Re: Query execution based on a condition

From: msi77 <msi77(at)yandex(dot)ru>
To: JORGE MALDONADO <jorgemal1960(at)gmail(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Query execution based on a condition
Date: 2012-12-29 19:36:56
Message-ID: 2795691356809816@web15e.yandex.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-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(at)gmail(dot)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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Adrian Klaver 2012-12-29 19:46:39 Re: Query execution based on a condition
Previous Message David Johnston 2012-12-29 19:23:35 Re: Query execution based on a condition