Subject | RE: [firebird-support] how to union a dubious query to another query |
---|---|
Author | Svein Erling Tysvær |
Post date | 2011-10-27T12:57:33Z |
>i want to union a query A to an other query B, if no any record in a,From your description, I would guess you want something like
>then automatically switch the 3rd query C to union the B. otherwise,
>the A can union to B.
>
>now i try to do it such as:
>
>select 0, 0, 0 from t1 /* C */
>
>where not exists(
> select f1, f2, f3 from t1
> where f1 = 'xxx' /* A */
> )
>
>union
>
>select f3, f4, f5 from t2 /* B */
select f1, f2, f3 from t1
where f1 = 'xxx'
union
select 0, 0, 0 from rdb$database
where not exists(
select f1, f2, f3 from t1
where f1 = 'xxx')
union
select f3, f4, f5 from t2
HTH,
Set