Subject | Re: [firebird-support] One query either of the two WHERE clause |
---|---|
Author | Mark Rotteveel |
Post date | 2013-11-25T08:57:03Z |
On 24 Nov 2013 23:46:29 -0800, <venussoftop@...> wrote:
recipe:
SELECT
...
FROM ....
WHERE <condition for first-set-of-conditions> AND
(<first-set-of-conditions>)
OR <condition for second-set-of-conditions> AND
(<second-set-of-conditions>)
EG
SELECT
*
FROM mytable
WHERE ? IS NULL AND (x=y)
OR ? IS NOT NULL AND (x=? OR y=?)
Mark
> Hi all(via
>
> I have a query in which I need to use either of two WHERE clauses
> depending on the parameters passed or no parameter passed to the query
> Remote View in VFP)...
>I found your where clauses not very readable, so I'll give a general
> Please advise on if and how I can have two different WHERE clause
> depending on external parameters having values. Till now I have passed
> parameters but the WHERE has always been one that adapted to the values
> passed as parameters.
recipe:
SELECT
...
FROM ....
WHERE <condition for first-set-of-conditions> AND
(<first-set-of-conditions>)
OR <condition for second-set-of-conditions> AND
(<second-set-of-conditions>)
EG
SELECT
*
FROM mytable
WHERE ? IS NULL AND (x=y)
OR ? IS NOT NULL AND (x=? OR y=?)
Mark