how to get the maximum among two tables,for example table 1
(dep1) have (emp_id,emp_name,salary) columns and table 2
(dept2) have (emp_id,emp_name,salary) columns,i want which
employee have the maximum salary among two tables?
Answer Posted / veeresh kethari
User CTE:
with Temp as(select max(sal) Sal from Table1
union
select max(sal) sal from Table2)
select top 1 * from Temp order by sal desc
Is This Answer Correct ? | 3 Yes | 0 No |
Post New Answer View All Answers
Describe and explain about SQL native client?
Stored Procedure returns data from multiple tables. How to access it in your ASP.Net code?
What is the sql case statement used for? Explain with an example?
hi, how to link a text file and a .rpt file in my tables of sql server and to retrieve those records for further use. reply me as soon as possible.
What is attribute? : sql server analysis services, ssas
What does it mean if @@cursor_row returns a negative number?
How to backup encryption key ?
What do you mean by a dependent functionality in a build?
What is the difference between varchar and nvarchar datatypes?
How to generate create procedure script on an existing stored procedure?
Tell me what is difference between clustered and non clustered index?
Tell me in brief how sql server enhances scalability of the database system?
Explain what are the different index configurations a table can have?
How to assign new column names in a view?
How would you use user_constraints table in DB?