I have an SQL query that includes a group by statement as well as a where clause.
The code looks like this:
SELECT one, AVG(two) AS Result
FROM dbo.[db_main]
WHERE (three = 1) AND (four = 'word') AND (five = 1)
GROUP BY one
ORDER BY one
The problem is that for the 'one' column, there are 93 unique records (Exisitng 1020 times each in the table, hence the AVG and GROUP BY part of this query).
The data is such that there is not necessarily a row that meets the criteria of this query for each of the 93 'ones', however I need the result set to show each 'one' with a value, even if there is no value.
Hope that makes sense. Any ideas?