I have 3 fields (ProjectCode,TradeCode, QuestionID)
Each project has various trades in it. Each question can come from any trade.
I thought I would run a simple count query, grouping by the other 2:
SELECT dbo_Bid.ProjectCode, dbo_Bid.TradeCode, Count(dbo_BiddersQuestions.QuestionId) AS CountOfQuestionId
FROM dbo_Bid INNER JOIN dbo_BiddersQuestions ON (dbo_Bid.TradeCode = dbo_BiddersQuestions.TradeCode) AND (dbo_Bid.TradeCode = dbo_BiddersQuestions.TradeCode) AND (dbo_Bid.ProjectCode = dbo_BiddersQuestions.ProjectCode)
GROUP BY dbo_Bid.ProjectCode, dbo_Bid.TradeCode;
but for some reason the count is multiplied but the number of trades per project.
ex: A project has trades A B and C. A asked 3 questions B asked 2 and C asked 5
what I get is that A asked 9, B asked 6, and C asked 15
If ther is only one trade it gives the the right answer, if 2 trades then it doubles it.
Can this have something to do with the way I set up the relationships?
Thanks!