Subject | How many Unions allowed in firebird Select? |
---|---|
Author | Tony Masefield |
Post date | 2005-11-05T17:08:05Z |
Hi all,
I'm trying to calculate the minimimum, maximum and average values of
a number of columns in a table thus (as a trial at first):
Select 'Minimum', Min(Col_1), Min(Col_2) from MyTable
Union
Select 'Maximum', Max(Col_1), Max(Col_2) from MyTable
Union
Select 'Average', Avg(Col_1), Avg(Col_2) from MyTable
Have tried EMS SQL Editor, IBExpert SQL Editor and TIBOQuery and all
give the error: SQL Error = -104, Invalid Command, DataType Unkown.
However, the select works up until the second Union is added. Is
this a limitation of Firebird?
The idea is to return a table with 3 rows, Minimum, Maximum and
Average, each row having the relevant column values for columns 1, 2
etc, - with values ultimately output using a DBGrid.
Comments/suggestions appreciated.
Regards
I'm trying to calculate the minimimum, maximum and average values of
a number of columns in a table thus (as a trial at first):
Select 'Minimum', Min(Col_1), Min(Col_2) from MyTable
Union
Select 'Maximum', Max(Col_1), Max(Col_2) from MyTable
Union
Select 'Average', Avg(Col_1), Avg(Col_2) from MyTable
Have tried EMS SQL Editor, IBExpert SQL Editor and TIBOQuery and all
give the error: SQL Error = -104, Invalid Command, DataType Unkown.
However, the select works up until the second Union is added. Is
this a limitation of Firebird?
The idea is to return a table with 3 rows, Minimum, Maximum and
Average, each row having the relevant column values for columns 1, 2
etc, - with values ultimately output using a DBGrid.
Comments/suggestions appreciated.
Regards