Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

consider a table which contain 4 columns,ename,eno,sal and
deptno, from this table i want to know ename who having
maximum salary in deptno 10 and 20.

Answer Posted / vishnu prasad.ma

SELECT A.EMP_NAME, SUM(B.MAX_SALARY) AS MAX_SAL, B.EMP_DEPT_NO FROM EMP_DETAILS A,
(SELECT MAX(EMP_SAL) AS MAX_SALARY, EMP_DEPT_NO FROM EMP_DETAILS WHERE EMP_DEPT_NO IN (10,20)
GROUP BY EMP_DEPT_NO) B
WHERE
A.EMP_SAL = B.MAX_SALARY
AND A.EMP_DEPT_NO = B.EMP_DEPT_NO
GROUP BY A.EMP_NAME, B.EMP_DEPT_NO

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a sql statement?

918


What is informix sql?

935


Does pl sql work in mysql?

939


How many types of sql are there?

955


What is Difference Between Unique and Primary Key Constraints?

1075


Explain the difference between triggers and constraints?

946


What is a left join?

903


Can we debug stored procedure?

976


what is top in tsql? : Transact sql

1048


Which constraints we can use while creating database in sql?

1037


what is the difference between inner and outer join? Explain with example. : Sql dba

991


Why we use stored procedure instead of query?

968


How do I view a procedure in sql?

927


What happens when a trigger is associated to a view?

862


What is the difference between null value, zero, and blank space?

1156