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 / abhishekjaiswal

select last_name,salary from employees where (salary,department_id) in ( select max(salary),
department_id from employees where department_id in (10,20) group by 
department_id) 
/
Output
LAST_NAME                     SALARY
------------------------- ----------
Hartstein                      13000
Whalen                          4400

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do you run a query?

980


what happens when the column is set to auto increment and you reach the maximum value for that table? : Sql dba

1021


How to start the command-line sql*plus?

1040


When should I use nosql database?

986


Does truncate table reset auto increment?

978


What is an ndf file?

974


What is view explain with example?

919


What is sql and explain its components?

1043


What is latest version of sql?

1028


How do I partition in sql?

943


What is an inconsistent dependency?

1031


what is the difference between truncate and delete statement? : Transact sql

1045


How do you use collections in procedure to return the resultset?

2229


Why do we go for stored procedures?

1034


What is cursor explain with example?

965