Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Ranking with highest count

Author  Topic 

keyursoni85
Posting Yak Master

233 Posts

Posted - 2012-02-15 : 12:29:08
Hi,

I have table for employee's rating employer wise.
rating tables holds rating out of 10 and employee and employer id.

I want to have highest rating (total sum) for employee among that employee's multiple ratings done by employers.

please help.

X002548
Not Just a Number

15586 Posts

Posted - 2012-02-15 : 12:30:26
Sure no problem

Please post the DDL of your Table, sample data in DML foprmat and what the expected results are suppose to look like based on the Sample Data



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx

http://weblogs.sqlteam.com/brettk/

http://brettkaiser.blogspot.com/


Go to Top of Page

keyursoni85
Posting Yak Master

233 Posts

Posted - 2012-02-15 : 12:52:23
[code]
crid employeeid employerid categoryid rating ratingfrom
1 1 2 1 5 10
1 1 2 2 4 10
1 1 3 1 10 10
1 1 3 2 8 10
[/code]

I want highest rating for employee among its employers rated..
above ex. have 18 rating for employee for employer 3.
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2012-02-15 : 13:24:55
I Still have no idea what you want..post what you have tried so far...

SELECT employeeid, SUM(rating) AS SUM_rating
FROM Table
GROUP BY Employeeid

???


Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx

http://weblogs.sqlteam.com/brettk/

http://brettkaiser.blogspot.com/


Go to Top of Page
   

- Advertisement -