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
What is an identity?
How can we determine what objects a user-defined function depends upon?
When would you use an insert into .. Select option versus an insert into .. Values option? Give an example of each?
Which is faster statement or preparedstatement?
What is hierarchy, what are its types and difference between them? : sql server analysis services, ssas
How to specify the collation for a character data type in ms sql server?
Are semicolons required at the end of sql statements in sql server 2005?
Is sql server free?
How do I view a script in sql server?
Suppose we have a table "MyTable" containing 10 rows, what query should be executed to update the odd rows "Salary" as 9000?
What is bcnf normalization form?
How to change parameter value inside the report?
What is self contained multi valued query?
Tell me something about security and sql azure?
Can anyone tell that the extra features are there in SQL SERVER 2008 that are not available in previous versions .