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
how we use window authentication connection with sql server.?
What does executeupdate return?
How to find tables without indexes?
What are entities and relationships?
Tell me what is difference between view and materialized view?
Differentiate between SQL and ORACLE joins and write their syntax.
What are the extra roles available in msdb? : sql server security
How to recompile stored procedure at run time?
How to drop existing indexes in ms sql server?
How to Insert multiple rows with a single insert statement?
Characterize join and name diverse sorts of joins?
Explain the steps to use transact-sql cursor?
What are the advantages of sql azure?
What are the disadvantages of indexes?
Differentiate between truncate vs delete in mssql?