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
what are the basic functions for master, msdb, model, tempdb and resource system databases? : sql server database administration
What is a data source or ds? : sql server analysis services, ssas
Can we add a cpu to sql server?
How to list all schemas in a database?
which table keeps the locking information? : Sql server administration
How to enter date and time literals in ms sql server?
Explain what role entity and relationship play in an ER diagram.
What is the sql server agent?
Explain magic tables in sql server?
Define left outer join in sql server joins?
What happens if strings are casted into wrong code pages in ms sql server?
Give the query of getting last two records from the table in SQL SERVER?
What are the different Topologies in which Replication can be configured?
How many databases Microsoft SQL server provides?
hi i am working as a testengineer , so i want to no the backend data base connection can any one tell mwe in detail