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 / kaka
create table #temp
(salary numeric(18,0)
)
insert into #temp
select max(salary) as salary from EmpSalary
union
select max(salary)as salary from EmpSalary1
select max(salary) from #temp
drop table #temp
Is This Answer Correct ? | 1 Yes | 1 No |
Post New Answer View All Answers
Delete duplicate rows without using rowid.
How many levels of sp nesting are possible?
Help!!!!!!!!!!!! My database has gone offline, it is highlighted as 'Suspect'. Foolishly, i haven't got a recent back up. Is there a way of quickly restoring the database? Thank you
What are translations and its use? : sql server analysis services, ssas
What is a file group?
What is collation?
Explain Geometry datatype in sql server 2008 with example
What is data file in computer?
What is the tcp/ip port on which sql server runs?
Does partitioning ssd reduce performance?
Explain what is cte (common table expression)?
Tell me what do you mean by an execution plan? Why is it used? How would you view it?
What are “phantom rows”?
How to test a dml trigger in ms sql server?
What is the chart in report?