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

Why variables called the most powerful component of ssis?

1027


What are the different SQL Server Versions you have worked on?

953


What are the commands used in DCL?

969


What is the importance of concurrency control?

1177


When we should use @@error?

914


Can binary strings be used in arithmetical operations?

887


how we use window authentication connection with sql server.?

1087


What is the Difference Between Primary and Foreign Key?

960


Can you tell me about the concept of ER diagrams?

1018


How to use the inserted and deleted pseudo tables?

916


can you instantiate a com object by using t-sql? : Sql server database administration

963


What do you mean by acid?

938


What is Lock table in SQL?

1412


What happens if you delete a table that is used by a view?

944


How does stuff differ from the replace function?

960