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 / sumathy
Use Cursors:
declare Cursor_Name cursor scroll
for
select max(salary) as salary from dep1
union
select max(salary) as salart from dep2 order by salary desc
open Cursor_Name
fetch absolute 1 from Cursor_Name
deallocate Cursor_Name
Is This Answer Correct ? | 13 Yes | 2 No |
Post New Answer View All Answers
How do you drop an index?
Relational calculus is what type of language?
What is a ddl statement?
What is the purpose of the model database?
explain databases and sql server databases architecture? : Sql server database administration
How would we use distinct statement? What is its use?
List some major differences between triggers and stored procedures?
What is named calculation? : sql server analysis services, ssas
How to create a new schema in a database?
What is resultset concur_updatable?
how to control the amount of free space in your index pages? : Sql server database administration
Can two different columns be merged into single column? Show practically?
What is 3nf normalization form?
Can primary key be null?
How to create database with physical files specified in ms sql server?