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

Write an sql query to sort a table according to the amounts in a row and find the second largest amount.

932


How to join two tables in a single query in ms sql server?

999


What number aggregate functions are accessible there in sql?

1078


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

1131


What is sql server replication? : sql server replication

996


If the job running very slow what is the action you do

1897


How do I shrink an ldf file?

983


Explain about service Broker functions?

1035


Why do we use stored procedures in sql server?

949


Explain the usage of floor function in sql server.

968


What do you understand by a stored procedure?

1093


Explain what is it unwise to create wide clustered index keys?

979


What is relationship? What number of sorts of relationship are there?

1143


Which data types generate inaccurate results if used with an = or <> comparison in a where clause of a sql statement?

1068


What is your recommendation for a query running very slow? : sql server database administration

1054