Subject | Conditional query? |
---|---|
Author | Steve Harp |
Post date | 2005-06-12T21:58:57Z |
Hi All,
Is it possible to use a conditional query without using a union? I
have a query which builds a string result such as this.
select Field1 || ', ' || Field2 || ', ' || Field3 AS TheField
I need to extend this to add additional fields dependant on the values
of some boolean fields (defined as 'T' or 'F'). I've tried this.
select Field1 || ', ' || Field2 || ', ' || Field3 ||
(Select ', New Text' from table where SomeField = 'T') AS TheField
This seems to work but, if the value is 'F', then TheField is null
instead of displaying the contents of the first 3 fields.
A union really isn't practical because the whole query is quite large
and complex with about 6 joins. Also, I've got 3 of these boolean
fields to deal with. What I'd like to find is something like this.
Select iif(SomeField = 'T', ' It Is True', ' It Is False') from table;
Thanks for any help,
Steve
Is it possible to use a conditional query without using a union? I
have a query which builds a string result such as this.
select Field1 || ', ' || Field2 || ', ' || Field3 AS TheField
I need to extend this to add additional fields dependant on the values
of some boolean fields (defined as 'T' or 'F'). I've tried this.
select Field1 || ', ' || Field2 || ', ' || Field3 ||
(Select ', New Text' from table where SomeField = 'T') AS TheField
This seems to work but, if the value is 'F', then TheField is null
instead of displaying the contents of the first 3 fields.
A union really isn't practical because the whole query is quite large
and complex with about 6 joins. Also, I've got 3 of these boolean
fields to deal with. What I'd like to find is something like this.
Select iif(SomeField = 'T', ' It Is True', ' It Is False') from table;
Thanks for any help,
Steve