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
What is efficiency data?
Explain how to maintain a fill factor in existing indexes?
Give a example to search fr a string in all stored procedure in sql server.
explain extended properties
What are the acid properties?
Are all views updatable ?
Can group functions be mixed with non-group selection fields in ms sql server?
What are the reporting services components?
Define compound operators?
What is Fragmentation and Defragmentation? For 32GB Table,How can we do the fragmentation?
How to start sql server browser service?
What does dml stand for?
Tell me what is log shipping?
Explain the creation and execution of a user-defined function in the sql server?
Can you tell me about the concept of ER diagrams?