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
What is sql server programming?
What is sqlservr.exe - process - sql server (sqlex?press)?
Introduction of rollup clause using sum and group by clause?
What is the need for group functions in sql?
What are the five characteristics of good data?
Can you explain different types of locks in sql server?
Explain boyce and codd normal form(bcnf)?
What type of locking occurs during the snapshot generation? : sql server replication
What is difference between createstatement and preparedstatement?
Is sql server 2016 free?
Where are stored procedures in sql server?
Explain transaction server isolation?
Can you explain what is indexed view? How to create it?
After removing a table from database, what other related objects have to be dropped explicitly?
Can we write ddl in trigger?