Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

Can we join two tables without primary key?

1057


Is the log file is a part of file group?

1041


what are user defined datatypes and when you should go for them? : Sql server database administration

1023


Difference Between ORDER BY Clause and GROUP BY Clause in SQL?

1059


What is a group function explain with an example?

993


What do you understand by check constraint in sql server?

947


Does partitioning help performance?

939


What is report subscription?

125


Can group by and orderby be used together?

1015


What is trigger in salesforce?

983


How to connect sql server management studio express to sql server 2005 express?

1045


What is implicit mode in sql server?

1109


Does partitioning improve performance?

981


List down some advantages of sql stored procedure?

966


Describe triggers features and limitations?

992