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...

two tables are there.1st table EMP has two columns ID and name and contains data 1,A
2,B
3,C
2nd table EmpSal has 2 columns ID and Salary
Contains data -1,1000
2,5000
3,3000

Find name of employee having maximum salary ?

Answer Posted / kanagavel

with cte
as
(
SELECT name,max(sal) as 'sal'
from emp1 inner join empsal
where emp1.id=empsal.id
group by name
)
select top 1 *
from cte
order by sal desc

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 recursion? Is it possible for a stored procedure to call itself or recursive stored procedure?

1011


What the different topologies in which replication can be configured?

1098


What are the types of database recovery models?

1131


What is row_number function?

1015


What is the purpose of data source?

1052


What is the synonym of join?

966


What is store procedure? How do they work? When do you use?

951


When columns are added to existing tables, what do they initially contain?

1041


Why does a sql statement work correctly outside of a user-defined function, but incorrectly inside it?

891


What are different types of statement?

1025


How does Report Builder support Analysis Services cubes?

156


We need to perform what steps in the following order to work with a cursor?

1220


What do you mean by SQL injection attack?

1081


What is the primary use of the model database?

1094


What is the difference between coalesce() & isnull()?

1141