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 what is use of dbcc commands?
What is blocking and how would you troubleshoot it? : sql server database administration
Is sql server difficult to learn?
What are the Advantages of using CTE in sql server?
How to restore performance issues and how to check?
What are Spatial data types in SQL Server 2008
How do I partition a table in sql server?
What is subquery in sql?
what is a schema in sql server 2005? Explain how to create a new schema in a database? : Sql server database administration
What program is used to store the data source file?
How to join two tables in a single query in ms sql server?
What are the types of database schema? : sql server analysis services, ssas
Are there any preferred steps that need to be taken care of before starting the installation of sql server 2000?
Explain indexed views and partitioned view with their syntax.
Where do we use trace frag?