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
Explain trigger and trigger types?
What are different types of replication in sql server?
Why use update_statistics command in sql server?
explain what is a schema in sql server 2005? Explain how to create a new schema in a database? : Sql server database administration
How to create a stored procedure with a statement block in ms sql server?
How to delete duplicate rows?
Is sql server difficult to learn?
Is the log file is a part of file group?
What is report subscription?
Do you know hot add cpu in sql server 2008?
what is the information that can be stored inside a bit column? : Sql server database administration
How to count duplicated values in a column in ms sql server?
What happens if you insert a duplicate key for the primary key column in ms sql server?
What is use of attribute hierarchy optimized state? : sql server analysis services, ssas
What is user-defined function? Explain its types i.e. Scalar and inline table value user-defined function?