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 / praveend

Try this. I have tried it.

Select id, name, Max(salary) as salary from
(Select id, name, salary from emp where salary = (Select
Max(salary) from emp)
Union
Select id, name, salary from emp1 where salary = (Select
Max(salary)from emp1)) as B


where salary = (
Select Max(salary) as salary from
(Select id, name, salary from emp where salary = (Select
Max(salary) from emp)
Union
Select id, name, salary from emp1 where salary = (Select
Max(salary)from emp1)) as C
)

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the distinction amongst delete and truncate?

1113


Show Practically Sql Server Views are updatable?

1193


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

1083


What is default constraint in ms sql server?

1106


Can you explain what are various ways to enhance the ssrs report?

1066


Explain about local stored procedure?

1031


How does a profiler work?

995


What is user defined datatypes and when you should go for them?

1073


What is outer join in sql server joins?

1187


List some major differences between triggers and stored procedures?

980


What are the hotfixes and patches in sql server?

1065


I have triggers,views,functions,stored Procedures for a table. When I am dropping that table which objects are deleted?

1195


Are null values the same as that of zero or a blank space?

1091


Can You Use A Stored Procedure To Provide Data To An Ssrs Report?

152


Explain the different types of backups available in sql server? : sql server database administration

989