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
Write an sql query to sort a table according to the amounts in a row and find the second largest amount.
How to join two tables in a single query in ms sql server?
What number aggregate functions are accessible there in sql?
How to insert multiple rows with one insert statement in ms sql server?
What is sql server replication? : sql server replication
If the job running very slow what is the action you do
How do I shrink an ldf file?
Explain about service Broker functions?
Why do we use stored procedures in sql server?
Explain the usage of floor function in sql server.
What do you understand by a stored procedure?
Explain what is it unwise to create wide clustered index keys?
What is relationship? What number of sorts of relationship are there?
Which data types generate inaccurate results if used with an = or <> comparison in a where clause of a sql statement?
What is your recommendation for a query running very slow? : sql server database administration