Subject Re: [firebird-support] Conditional query?
Author Ann W. Harrison
Steve Harp wrote:
> 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.

Use coalesce on the result of the subquery to turn the null into an
empty string.


REgards,


Ann