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 tablesample?
What is the difference between indexing and hashing?
what's the difference between delete table and truncate table commands? : Sql server database administration
You schedule a job to run every minute what will happen if the first job runs more than 1 min? Will the second instance of the job start?
What do you understand by the data quality services in sql server?
What is trace flag in sql server?
What is self contained sub query?
What is repeatable read?
application server is slow what may be the problem
Can an automatic recovery be initiated by a user?
What do you mean by stored techniques? How would we use it?
What are different types of constraints?
What is sqlcmd?
Where sql server usernames and passwords are stored in a sql server?
How do you create a data source?