Yes, of course. I noticed that only after I posted it. Not sure which of the following is logically correct in your problem, but it should be one of these. If it is neither, can you post some sample data?:SELECT COUNT(DISTINCT dbo.SurveyAnswerInfo.SurveyAnswerInfoID * dbo.Grade.GreenGrade) AS Green, COUNT(DISTINCT dbo.SurveyAnswerInfo.SurveyAnswerInfoID * dbo.Grade.YellowGrade) AS Yellow, COUNT(DISTINCT dbo.SurveyAnswerInfo.SurveyAnswerInfoID * dbo.Grade.RedGrade) AS Red, dbo.Avdelning.Name, dbo.Category.CatgoryNameFROM dbo.SurveyAnswers INNER JOIN dbo.SurveyAnswerInfo ON dbo.SurveyAnswers.SurveyAnswerInfoID = dbo.SurveyAnswerInfo.SurveyAnswerInfoID INNER JOIN dbo.Question ON dbo.SurveyAnswers.QuestionID = dbo.Question.QuestionID INNER JOIN dbo.Category ON dbo.Question.CategoryID = dbo.Category.CategoryID INNER JOIN dbo.Grade ON dbo.Category.CategoryID = dbo.Grade.CategoryID INNER JOIN dbo.Users ON dbo.SurveyAnswerInfo.UserID = dbo.Users.UserID INNER JOIN dbo.Avdelning ON dbo.Users.AvdID = dbo.Avdelning.AvdIDWHERE (dbo.Users.CustID = 2)GROUP BY dbo.Avdelning.Name, dbo.Category.CatgoryName
or SELECT COUNT(DISTINCT dbo.SurveyAnswerInfo.SurveyAnswerInfoID) * dbo.Grade.GreenGrade AS Green, COUNT(DISTINCT dbo.SurveyAnswerInfo.SurveyAnswerInfoID) * dbo.Grade.YellowGrade AS Yellow, COUNT(DISTINCT dbo.SurveyAnswerInfo.SurveyAnswerInfoID) * dbo.Grade.RedGrade AS Red, dbo.Avdelning.Name, dbo.Category.CatgoryNameFROM dbo.SurveyAnswers INNER JOIN dbo.SurveyAnswerInfo ON dbo.SurveyAnswers.SurveyAnswerInfoID = dbo.SurveyAnswerInfo.SurveyAnswerInfoID INNER JOIN dbo.Question ON dbo.SurveyAnswers.QuestionID = dbo.Question.QuestionID INNER JOIN dbo.Category ON dbo.Question.CategoryID = dbo.Category.CategoryID INNER JOIN dbo.Grade ON dbo.Category.CategoryID = dbo.Grade.CategoryID INNER JOIN dbo.Users ON dbo.SurveyAnswerInfo.UserID = dbo.Users.UserID INNER JOIN dbo.Avdelning ON dbo.Users.AvdID = dbo.Avdelning.AvdIDWHERE (dbo.Users.CustID = 2)GROUP BY dbo.Avdelning.Name, dbo.Category.CatgoryName, dbo.Grade.GreenGrade,dbo.Grade.YellowGrade,dbo.Grade.RedGrade