Subject Re: [IBO] UNION
Author Aage Johansen
On Tue, 23 Dec 2003 15:50:14 +0000 (UTC), Jonathan M. Freedman wrote:

> i have a query i am developing using the query component...it involves
> combining parts of two tables with a UNION command...the query builds and
> prepares when i UNION two tables, but when i add the 3rd, it doesn't
> prepare...it gives me back an error message that i have an unknown data
> type. Both the query and the error message are printed below...cbuilder
> 6 prof, firebird 1.5 rc7, ibo 4.3.A.a., windows xp prof. How does one
> UNION 3 tables?
>
> tyia
>
> SELECT
> CH.NAM
> , CH.DOB
> , CH.REL
> , CH.CLNTFK
> , CH.HXCHILDPK
> FROM HXCHILD CH UNION
> SELECT
> SI.NAM
> , SI.DOB
> , SI.REL
> , SI.CLNTFK
> , SI.HXSIBSPK
> FROM HXSIBS SI
>
> UNION
>
> SELECT
> SP.NAM
> , SP.DOB
> , SP.REL
> , SP.CLNTFK
> , SP.HXSPOUSPK
> FROM HXSPOUS SP
>
> ---------------------------
> C++Builder 6
> ---------------------------
> ISC ERROR CODE:335544569
>
>
>
> ISC ERROR MESSAGE:
> Dynamic SQL Error
> SQL error code = -104
> Invalid command
> Data type unknown


Are you sure that all corresponding fields have the same definition?
E.g. If CH.NAM is varchar(30), SP.NAM must also be varchar(30)m and so
on. If they are different, try to cast them to a common type.

--
Aage J.