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 an identity?

982


How can we determine what objects a user-defined function depends upon?

983


When would you use an insert into .. Select option versus an insert into .. Values option? Give an example of each?

1082


Which is faster statement or preparedstatement?

921


What is hierarchy, what are its types and difference between them? : sql server analysis services, ssas

1241


How to specify the collation for a character data type in ms sql server?

1007


Are semicolons required at the end of sql statements in sql server 2005?

965


Is sql server free?

894


How do I view a script in sql server?

1027


Suppose we have a table "MyTable" containing 10 rows, what query should be executed to update the odd rows "Salary" as 9000?

968


What is bcnf normalization form?

1096


How to change parameter value inside the report?

162


What is self contained multi valued query?

986


Tell me something about security and sql azure?

114


Can anyone tell that the extra features are there in SQL SERVER 2008 that are not available in previous versions .

1933