Subject Re: How many Unions allowed in firebird Select?
Author Tony Masefield
--- In, Daniel Rail <daniel@a...>
> You say that when doing a union with the first two works. But what
> happens that you forget the first union and only union the last two
> selects(i.e. MAX with AVG)? Do you get the same error? And, if you
> do, try casting AVG as the same datatype as the column.
Thank you Daniel - 100% correct. Using a Cast (to smallint - same as
columns) works for AVG(). Had assumed that the conversion would have
been automatic (mistake).
Strangely enough, Count and Sum also give the same error (assuming the
first two selects are Min and Max) as AVG which threw me off - Can't
understand why - assume the internal data structures must be different
between, Max, Min, Avg, Count and Sum.
I suppose the moral is "When in doubt Cast"?