Subject Re: [firebird-support] SQL UNION ALL
Author Thomas Steinmaurer
Hi,

> why this union don't work:
>
> SELECT SUM(A), B, C, D
> FROM X,T,Z
> WHERE set_condition_1
> GROUP BY B, C, D, A
> ORDER BY B
>
> UNION ALL
>
> SELECT SUM(A), B, C, D
> FROM X,T,Z
> WHERE set_condition_2
> GROUP BY B, C, D, A
> ORDER BY B
>
> The queries above (separated) work fine but if I use the statemant union I obtain a SQL error.

Remove the ORDER BY clause in the first select statement.



--
Best Regards,
Thomas Steinmaurer
LogManager Series - Logging/Auditing Suites supporting
InterBase, Firebird, Advantage Database and MS SQL Server
Upscene Productions
http://www.upscene.com