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

To which devices can a backup be created and where should these devices be located? : sql server management studio

1059


Can we insert data into view sql server?

942


How to verify the port number of the sql server?

1172


Is it possible in sql table to have more than one foreign key?

1051


How to Check if table exists in sql server?

1149


What is key set driven?

965


How to disable triggers using "disable trigger"?

1063


List the advantages of using stored procedures?

1066


Tell me what is a linked server?

1046


Define self join?

1035


What is database replication?

1157


Is it possible for a stored procedure to call itself or recursive stored procedure? How many levels of sp nesting are possible?

892


Explain what you mean by 3 tier architecture.

1080


What is an expression in ms sql server?

1090


Why normalization is used?

1022