I have a employee table with EMPID, EMPNAME, DEPTID, SAL
and want to fetch the maximum and minimum salary on each
dept id with the emp name. Can anyone help in this? The
result should contain the EMPNAME, DEPTID, SAL.

Answer Posted / hariharan

sel empname, a.deptid, b.salary
from t1_metadata.emp_test a,
(
sel
deptid, max(sal)
from t1_metadata.emp_test
group by 1
union
sel
deptid, min(sal)
from t1_metadata.emp_test
group by 1
)b (deptid, salary)
where a.deptid = b.deptid
and a.sal=b.salary

Is This Answer Correct ?    8 Yes 11 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Name the five phases that come under MultiLoad Utility.

584


What are default access rights in teradata?

619


Explain fallback in teradata?

602


What is meant by a Least Cost Plan?

616


What is node? How many nodes and amps used in your previous project?

669






What are the joins in teradata?

565


In BTEQ, how are the session-mode parameters being set?

650


What are the steps involved after the disk manager passes the request?

572


How teradata makes sure that there are no duplicate rows being inserted when its a set table?

553


What are the frequently used data types in teradata?

592


How do you set the session mode parameters in bteq?

603


Can we collect statistics on multiple columns?

562


How is MLOAD Client System restarted after execution?

595


If I wanted to run a TPump job only once per day - basically working on a file that is produced once per day - how would you set up the parameters for that sort of job ?

1891


How to Extract data from multiple legacy systems?

572