i have employee table with 3 coloums
emp name companyname experience
1 1 3.5
2 2 4.0
1 1 2.6
2 2 3.0
3 3 5.0
i want the result table like this
emp name comany name experience
1 1 6.1
2 2 7.0
3 3 5.0
anyone tell me the sql query for this ?

9 Years
Discussion Span
Last Post by LizR

What have you tried? You give no example code, so we have no information to help you with .. looks like a simple case of sorting and grouping to me.


Looking at the numbers hes adding the results together.

Votes + Comments
Well noticed with a fine eye!

Well Ive given some big hints up earlier too.. but yes, the SQL for it should be a real simple 1 line uncomplex answer.. Im interested to see what the original posters tried so far.


That wasn't easy for me to see and if you hadn't pointed it out I don't know if I would have caught it.

how in the world did you see that randomly?


Because to me its obvious :) - Im that odd.

Of course it would help if the initial poster could define their requirements in proper terms it would help them help themselves.

Far too many posts are a bunch almost nonsensical jabberings and with a final comment of all but "code please" .. if you cant define clearly what you want, its highly likely you wont be able to code it either.


I am not clear about your table because what is entity in your table.


E.empname, E.companyname as 'Company Name', Sum(E.experience) as 'Experience'
FROM employee E
GROUP BY E.empname, E.companyname

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.