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 tablesample?

1118


What is the difference between indexing and hashing?

1175


what's the difference between delete table and truncate table commands? : Sql server database administration

989


You schedule a job to run every minute what will happen if the first job runs more than 1 min? Will the second instance of the job start?

1040


What do you understand by the data quality services in sql server?

953


What is trace flag in sql server?

1031


What is self contained sub query?

1066


What is repeatable read?

1025


application server is slow what may be the problem

2229


Can an automatic recovery be initiated by a user?

1020


What do you mean by stored techniques? How would we use it?

1041


What are different types of constraints?

928


What is sqlcmd?

1062


Where sql server usernames and passwords are stored in a sql server?

993


How do you create a data source?

918