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 / veeresh kethari

User CTE:

with Temp as(select max(sal) Sal from Table1
union
select max(sal) sal from Table2)
select top 1 * from Temp order by sal desc

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the recovery models for a database?

1146


What is transact-sql ddl trigger?

1148


How to round a numeric value to a specific precision?

1126


Is INSTEAD OF trigger directly applicable to Table ?

1068


How to create new tables with "select ... Into" statements in ms sql server?

1048


Tell me about normalization in DBMS.

1061


In which format does an image save in SQL Server database ?

1057


What is a primary key?

999


How column data types are determined in a view?

1008


List out different types of normalizations in sql server and explain each of them?

975


If you are given access to a SQL Server, how do you find if the SQL Instance is a named instance or a default instance?

1176


What to perform pattern match with the like operator?

934


How to defragment indexes with alter index ... Reorganize?

1137


What is the recovery model?

1059


How to insert multiple rows with one insert statement in ms sql server?

1180