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 / newbie
SELECT MAX(E.Salary) FROM
(SELECT MAX(Salary) SalaryFROM dep1
UNION
SELECT MAX(Salary) Salary FROM dep2) E
| Is This Answer Correct ? | 36 Yes | 5 No |
Post New Answer View All Answers
To which devices can a backup be created and where should these devices be located? : sql server management studio
Can we insert data into view sql server?
How to verify the port number of the sql server?
Is it possible in sql table to have more than one foreign key?
How to Check if table exists in sql server?
What is key set driven?
How to disable triggers using "disable trigger"?
List the advantages of using stored procedures?
Tell me what is a linked server?
Define self join?
What is database replication?
Is it possible for a stored procedure to call itself or recursive stored procedure? How many levels of sp nesting are possible?
Explain what you mean by 3 tier architecture.
What is an expression in ms sql server?
Why normalization is used?