SQL Server - inner join Query problem - Asked By raj kumar on 18-Apr-13 01:15 AM

First table Value:
-------------------
eid eName
2 raj
3 kumar
4 ajay

Second table Value:
-----------------------
eid eSalary
2 1000
2 2000
3 3000
3 4000
4 5000
4 6000

I want Below Result(max Salary based on eid):
eid  ename  esalary
2 raj 2000
3 kumar 4000
4 ajay 6000

Please give me correct Query
sri replied to raj kumar on 18-Apr-13 06:03 AM
Hi Raj,

try this,

 

select e.id, e.name, s.salary
from emp e, salary s
where e.id=s.id
raj kumar replied to sri on 19-Apr-13 08:02 AM
Hai Sir,

just now i tried this query but this one is not Correct.
shital patil replied to raj kumar on 25-Apr-13 02:31 AM
Hello Raj,
     please use following query:

select e.eid, e.name, MAX(s.salary)
from Employee e, salary s
group by e.eid, e.name