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 2000 Forums
 SQL Server Development (2000)
 Query problem

Author  Topic 

yolip
Starting Member

4 Posts

Posted - 2006-04-19 : 20:52:05
Hi all,

I expect the following query to give me the count (tblRating.Count) of individule Description, but it just adding up the count incrementally. How can i reset the count for each description? it is appreciate if anyone can give me a hand.

Thanks
Yolip


SELECT DISTINCT tblRating.Description, Count(AIM_ACHIEV.RATING) AS RatingCount, tblRating.Count
FROM (AIM INNER JOIN ((((AIM_ACHIEV INNER JOIN AIM_OBJ_DELIV ON AIM_ACHIEV.OUTPUT_ID = AIM_OBJ_DELIV.ID) INNER JOIN tblRating ON AIM_ACHIEV.RATING = tblRating.Rating) INNER JOIN AIM_OBJ ON AIM_OBJ_DELIV.STRATEGY_ID = AIM_OBJ.ID) INNER JOIN KEYCOUNCIL ON AIM_OBJ.KCID = KEYCOUNCIL.ID) ON AIM.ID = KEYCOUNCIL.AIM_ID) INNER JOIN CSF ON AIM.CSF_ID = CSF.ID
WHERE (((FinYearQuarter([QTRDATE]))=[Quarter]) AND ((AIM_OBJ_DELIV.STATUS)=-1) AND ((AIM_OBJ.CORPORATEPLAN)=-1)) OR (((AIM_OBJ.AIPLAN)=-1))
GROUP BY tblRating.Description, tblRating.Count, CSF.ID
HAVING (((CSF.ID)=[ThemeID]))
ORDER BY tblRating.Count;

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-04-19 : 21:42:00
tried GROUP BY tblRating.Description, CSF.ID ?



KH


Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-04-20 : 01:33:37
or

Post some sample data and the result you want

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -