>i want to union a query A to an other query B, if no any record in a, 
>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 */

>From your description, I would guess you want something like

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

Reply via email to