Subject | RE: [firebird-support] conditional where clause |
---|---|
Author | Paul Mercea |
Post date | 2006-07-11T12:15:06Z |
You can use CASE
SELECT
o.ID,
o.Description,
CASE o.Status
WHEN 1 THEN 'confirmed'
WHEN 2 THEN 'in production'
WHEN 3 THEN 'ready'
WHEN 4 THEN 'shipped'
ELSE 'unknown status ''' || o.Status || ''''
END
FROM
Orders o
Regards,
Paul
From: firebird-support@yahoogroups.com
[mailto:firebird-support@yahoogroups.com] On Behalf Of Cornel Rebegea
Sent: Tuesday, July 11, 2006 1:58 PM
To: firebird-support@yahoogroups.com
Subject: [firebird-support] conditional where clause
Hi. Is there a way to do a conditional where clause?
I mean something like this:
select * from <table>
where iif(<something>, true, <filter>)
Thanks in advance.
[Non-text portions of this message have been removed]
SELECT
o.ID,
o.Description,
CASE o.Status
WHEN 1 THEN 'confirmed'
WHEN 2 THEN 'in production'
WHEN 3 THEN 'ready'
WHEN 4 THEN 'shipped'
ELSE 'unknown status ''' || o.Status || ''''
END
FROM
Orders o
Regards,
Paul
From: firebird-support@yahoogroups.com
[mailto:firebird-support@yahoogroups.com] On Behalf Of Cornel Rebegea
Sent: Tuesday, July 11, 2006 1:58 PM
To: firebird-support@yahoogroups.com
Subject: [firebird-support] conditional where clause
Hi. Is there a way to do a conditional where clause?
I mean something like this:
select * from <table>
where iif(<something>, true, <filter>)
Thanks in advance.
[Non-text portions of this message have been removed]