RE: Aggregates in Queries
Posted in 1997
Hi , What i am trying to do is ., if there are 5 departments ,i want the sum of the maximum salaries of all 5 departments. select sum(max(sal)) from tab_1 group by dept_code. In other words i want select the max salary in each dept and sum them up. This works in Oracle .Why not in Informix 7.1 online? Bye ****************************************************************************** S.Sathish email :ssathish@cmcbang.ernet.in ****************************************************************************** On Wed, 15 Oct 1997, Scott Black wrote: } For one thing in your particular example sum(max(sal)) and max(sal) are } identical. Max returns one record, if you sum one record you get that } same record. } } > -----Original Message----- } > From: S SATHISH-SI [SMTP:ssathish@getafix.cmc.net.in] } > Sent: Wednesday, October 15, 1997 9:15 AM } > To: informix-list@rmy.emory.edu } > Subject: Aggregates in Queries } > } > Hi, } > Why does Online 7.1 disallow nesting aggregates in queries. } > eg., } > Select sum(max(sal)) from emp where ... group by ... } > In case i want the sum of the maximum salaries in a department without } > } > writing a subquery? } > Bye } > } > ********************************************************************** } > ******** } > S.Sathish } > email :ssathish@cmcbang.ernet.in } > ********************************************************************** } > ******** } > }