Subject Re: [firebird-support] Problem with UNION
Author Milan Babuskov
sifi24viper wrote:
> Follow i have a UNION-Query that doesn't work!
> Invalid token.Dynamic SQL Error.
> SQL error code = -104.
> Invalid command.
> Data type unknown.
>
> But when i try the two SELECT-Statment separatly they work fine!
>
> May somebody have an idea!

You need to cast() the datatypes of colums whose datatypes differ. For
example:

> 0 AS "Amin_Total",

cast( 0 as double precision)

> SUM(VERBRAUCH_KSA.MENGE) AS "Sand_Total"

cast(SUM(VERBRAUCH_KSA.MENGE) as double precision)

> SUM(VERBRAUCH_BGG.MENGE) AS "Amin_Total",

cast(SUM(VERBRAUCH_BGGA.MENGE) as double precision)

> 0 AS "Sand_Total"

cast( 0 as double precision)


Of course, don't use "double precision" but whatever the datatype
VERBRAUCH_BGGA.MENGE is using.

--
Milan Babuskov
http://www.flamerobin.org