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 is collation sensitivity? Explain different types.

1010


what is the Ticketing tool used in Wipro technologies at Bangalore...???

8156


What does top operator do?

1020


How to delete database objects with "drop" statements in ms sql server?

1089


Tell me what is difference between view and materialized view?

937


Why does sql studio use a single registered database repository? : sql server management studio

999


What do you mean by a Composite primary key?

1103


How except clause is differs from not in clause?

953


What is the server name for sql management studio?

1024


What are ddl (data definition language) statements for tables in ms sql server?

1104


What is the difference between NOROW and LOCKROW?

2838


what is isolation level at dead lock?

2151


How do I clean up sql server transaction log?

1066


What are three ways you can use an identity value inside a trigger? Why would you prefer one way over another?

1000


How to create prepared statements using odbc_prepare()?

1065