Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref

Author Message

New User

Joined: 09 Mar 2005
Posts: 3

 Posted: Fri Apr 29, 2005 3:20 pm    Post subject: Query to retrive the second AVERAGE Column from the table hai all, pls reply with sql query how we retrieve the second avg value from column of a particular table is there any sutable query pls fwd it regards madduri_25 team

priyesh.agrawal

Senior Member

Joined: 28 Mar 2005
Posts: 1452
Location: Chicago, IL

 Posted: Fri Apr 29, 2005 4:26 pm    Post subject: Re: Query to retrive the second AVERAGE Column from the tabl Second Avg means what....will you be please more clear....... Regards, Priyesh
ovreddy

Active User

Joined: 06 Dec 2004
Posts: 211
Location: Keane Inc., Minneapolis USA.

 Posted: Wed May 04, 2005 1:49 pm    Post subject: Re: Query to retrive the second AVERAGE Column from the tabl Hi Madduri, Average is a group function which gives a single result by taking a group of rows as input. So we will have only one average for a column. Please clarify us about your question in more detail. Eg: select avg(sal) from myuser.emp; Returns average of salary which is only one value. So what is the second average vale? Thanks, Reddy.
ssowjanya

New User

Joined: 29 Apr 2005
Posts: 13

 Posted: Wed May 04, 2005 1:54 pm    Post subject: Re: Query to retrive the second AVERAGE Column from the tabl Hi Madduri, Is the query is like this... write a query to find the second max sal?
nrsmca

New User

Joined: 25 May 2005
Posts: 14

 Posted: Fri Jun 10, 2005 2:37 pm    Post subject: Re: Query to retrive the second AVERAGE Column from the tabl Hi, Select avg(salary) from Table1 a where 2 = (select count (*) from Table1 b where b.salare >= a.salary); N th Max. Avg value calculation, Select avg(salary) from Table1 a where n = (select count (*) from Table1 b where b.salare >= a.salary); Regards, N.R.S,mca
ovreddy

Active User

Joined: 06 Dec 2004
Posts: 211
Location: Keane Inc., Minneapolis USA.

 Posted: Wed Jun 15, 2005 3:01 pm    Post subject: Hi NRS, Sorry I am not getting. What you are trying for. U mean to find the average of salries after exclusing the highest salary. But as I know there is no concept of second average??? If I am wrong please correct me with explanation. Thanks, Reddy.
 All times are GMT + 6 Hours
 Page 1 of 1

Search our Forum:

 Topic Author Forum Replies Posted Similar Topics Extracting DDL for all list of intere... Ashishpanpaliya DB2 5 Mon May 21, 2018 4:08 pm How to force a select query to abend neo4u DB2 7 Mon Apr 23, 2018 1:36 pm Searching a table for the field name? socker_dad COBOL Programming 8 Sat Mar 31, 2018 2:57 am Need inputs on DB2 tablespace/table r... ashek15 DB2 3 Sat Mar 24, 2018 11:49 pm Query to compare 2 values of 1 column... Poha Eater DB2 13 Fri Mar 09, 2018 10:45 am

 © 2003-2017 IBM MAINFRAME Software Support Division
 Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us