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.
| 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. ThanksYolipSELECT DISTINCT tblRating.Description, Count(AIM_ACHIEV.RATING) AS RatingCount, tblRating.CountFROM (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.IDWHERE (((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.IDHAVING (((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 |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-04-20 : 01:33:37
|
| orPost some sample data and the result you wantMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|