This is a bit convoluted but I will try to make it not so. Below is a snippet of the data and the intended result below it. For every combination of state, area, indcode, and ownership I want to calculate an average. My knowledge of AVG in SQL would average the entire column not just specific values. How does one do this?
asked Oct 10 at 11:33 PM in Default
The select statement in the comment is pretty far off, so it might make sense to visit the SELECT (Transact-SQL) page on MSDN site and study it. After all, select is the most important feature of T-SQL. Here is the statement which should produce desired results:
Generally speaking, the practice of using T-SQL keywords as column names is ill advised, but I know it happens all the time. If the keyword must be used for column name then any references to it from the script should be wrapped into square brackets.
Hope this helps.