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

How to select first n records in teradata?

611


Highlight the points of differences between the database and user in Teradata.

591


What are the steps to create a data model?

602


If Fast Load Script fails and only the error tables are made available to you, then how will you restart?

634


Why are oltp database designs not generally a good idea for a data warehouse?

598






What is dimensional modeling?

595


Explain teradata architecture?

634


What do you mean by teradata sql assistant?

591


What is bteq script in teradata?

633


Difference between inner join and outer join?

587


Hi send me the Teradata dumps to my id rajeshanantha@yahoo.co.in Thanks Rajesh. A

2907


What are the different functions included in the server software?

603


How you will check the version of teradata?

590


Can any one explain me the difference between BTEQ and MLOAD,TUMP. All canbe used for same purpose but still differnt methods. why ?

3001


any one answer me how they can analyzing the project using data ware housing?

2028