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
What is collation sensitivity? Explain different types.
what is the Ticketing tool used in Wipro technologies at Bangalore...???
What does top operator do?
How to delete database objects with "drop" statements in ms sql server?
Tell me what is difference between view and materialized view?
Why does sql studio use a single registered database repository? : sql server management studio
What do you mean by a Composite primary key?
How except clause is differs from not in clause?
What is the server name for sql management studio?
What are ddl (data definition language) statements for tables in ms sql server?
What is the difference between NOROW and LOCKROW?
what is isolation level at dead lock?
How do I clean up sql server transaction log?
What are three ways you can use an identity value inside a trigger? Why would you prefer one way over another?
How to create prepared statements using odbc_prepare()?