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 / newbie

SELECT MAX(E.Salary) FROM
(SELECT MAX(Salary) SalaryFROM dep1
UNION
SELECT MAX(Salary) Salary FROM dep2) E

Is This Answer Correct ?    36 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain what is use of dbcc commands?

1131


What is blocking and how would you troubleshoot it? : sql server database administration

1093


Is sql server difficult to learn?

966


What are the Advantages of using CTE in sql server?

1164


How to restore performance issues and how to check?

2050


What are Spatial data types in SQL Server 2008

1067


How do I partition a table in sql server?

1097


What is subquery in sql?

1125


what is a schema in sql server 2005? Explain how to create a new schema in a database? : Sql server database administration

1111


What program is used to store the data source file?

1004


How to join two tables in a single query in ms sql server?

1056


What are the types of database schema? : sql server analysis services, ssas

1184


Are there any preferred steps that need to be taken care of before starting the installation of sql server 2000?

1028


Explain indexed views and partitioned view with their syntax.

1190


Where do we use trace frag?

1059