GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

  GeekInterview.com  >  Interview Questions  >  Data Warehousing  >  ETL

 Print  |  
Question:  Develop a mapping to extract the employee drawing maximum salary where deptno = department drawing maximum sum(salary) group by dept.
sources are cobol files / flat files.


Answer: This is the recent question faced in ibm.


November 11, 2007 07:55:00 #2
 viswanadh kintali   Member Since: Visitor    Total Comments: N/A 

RE: Develop a mapping to extract the employee drawing ...
 
I dont think this can by using a mapping. Following sql gives the dept number that gives maximum salary paid to all the employees put together.

SELECT b

.deptno
FROM

(SELECT deptno,

SUM(salary) sal FROM emp GROUP BY deptno) b

WHERE

sal= (SELECT  MAX(a.sal) sals
FROM (select deptno, sum (salary) sal
FROM emp GROUP BY
deptno) a)


Let me know if this helped you.

visu

     

 

Back To Question