Subject | Re: UNION |
---|---|
Author | stanw1950 |
Post date | 2003-12-23T18:26:14Z |
--- In IBObjects@yahoogroups.com, "Jonathan M. Freedman"
<jonathanmfreedman@h...> wrote:
should work. For all three tables make sure the data types are
exactly the same for each equivalent field. If they aren't, you'll
get a data type unknown error. Run the query outside of your program
in some management program to test it. Also, if the data from the
three tables don't overlap "union all" is suppose to be faster than
just "union".
<jonathanmfreedman@h...> wrote:
> i have a query i am developing using the query component...itthe
> involves combining parts of two tables with a UNION command...the
> query builds and prepares when i UNION two tables, but when i add
> 3rd, it doesn't prepare...it gives me back an error message that iare
> have an unknown data type. Both the query and the error message
> printed below...cbuilder 6 prof, firebird 1.5 rc7, ibo 4.3.A.a.,This is really an sql problem and not an IBO problem but your query
> 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
should work. For all three tables make sure the data types are
exactly the same for each equivalent field. If they aren't, you'll
get a data type unknown error. Run the query outside of your program
in some management program to test it. Also, if the data from the
three tables don't overlap "union all" is suppose to be faster than
just "union".