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 trigger and trigger types?

987


What are different types of replication in sql server?

1087


Why use update_statistics command in sql server?

1058


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

942


How to create a stored procedure with a statement block in ms sql server?

1070


How to delete duplicate rows?

998


Is sql server difficult to learn?

923


Is the log file is a part of file group?

1041


What is report subscription?

125


Do you know hot add cpu in sql server 2008?

955


what is the information that can be stored inside a bit column? : Sql server database administration

966


How to count duplicated values in a column in ms sql server?

1095


What happens if you insert a duplicate key for the primary key column in ms sql server?

977


What is use of attribute hierarchy optimized state? : sql server analysis services, ssas

1063


What is user-defined function? Explain its types i.e. Scalar and inline table value user-defined function?

906