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...

please can anyone answer this query

Table 1 has 2 columns: EmployeeId,Age
Table 2 has 2 columns: EmployeeId, Region
Write SQL to Find the region who has the oldest person

Answer Posted / anil panwar

Hi Shivaraj
the ans you have given that is correct but
anyway,
if different employee id have same age and different region
and region is null in that case will not show Null region
for that employee


it may be solution....

select t1.id, t2.region from t1 left outer Join t2
on t1.id=t2.id
where t1.id in (select id from t1 where age=(select max(age)
from t1)) group by t1.id, t2.region

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Does the unique constraint create an index?

988


What is difference between index and primary key?

1040


Write a query for primary key constraint with identity key word?

972


How to test values returned by a subquery with the in operator?

1133


What is key attribute?

869


What happens if null values are involved in arithmetic operations?

962


Why I have to use stored procedures?

979


Difference between primary key and clustered index?

933


You have a table with close to 100 million records recently, a huge amount of this data was updated now, various queries against this table have slowed down considerably what is the quickest option to remedy the situation?

840


Equi join and non equi join is possible with sql server?

938


To which devices can a backup be created and where should these devices be located? : sql server management studio

968


How will you go about resolving deadlocks?

909


Is BCNF better than 2NF & 3NF? Why?

1002


What are the difference between primary key and unique key? : sql server database administration

892


How can a database be repaired?

923