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
In which tcp/ip port does sql server run? Can it be changed?
What is the difference between function and stored procedure in sql server?
What is compound operators?
how can a database be repaired? : Sql server administration
How do I make a resultset scrollable?
how would you improve etl (extract, transform, load) throughput?
Explain atomicity?
How to encrypt data between dialogs?
Difference between connected and disconnected database in .net with sql server?
Can you explain what are various ways to enhance the ssrs report?
what is an extended stored procedure? : Sql server database administration
Explain various On-Delete options in a DB table. Which is the default option?
What is the Disadvantage of indexed sequential file.
What is query parameter in ssrs?
Why truncate is ddl?