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
Explain tables in SQL Azure?
What is cursors?
Explain the concept of view and Types of views in SQL server?
What is compression - row-level and page-level compression?
How you can change the database name in SQL SERVER?
What is the difference between dataadapter and datareader?
What is meant by indexing files?
Can we use trigger new in before insert?
Is sql server is free?
What is the difference between varchar and nvarchar datatypes?
What is implicit cursors?
What is the contrast between sql and pl/sql?
Tell me what is a linked server?
Does a specific recovery model need to be used for a replicated database? : sql server replication
What is the guest user account in sql server? What login is it mapped to it? : sql server security