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 |
|
Woodzy
Starting Member
7 Posts |
Posted - 2005-01-16 : 16:36:29
|
| HelloHow do you AVG a COUNT result? I'm fairly new to SQL and can't find this in my book (SQL Server 2000). Any pointers would be appreciated. SELECT Genre, COUNT (Genre) as 'Movies Per Genre'FROM Movies IN WHERE Movies IN(SELECT AVG ([Movies Per Genre]))GROUP BY GenreThanks, Woodzy |
|
|
rockmoose
SQL Natt Alfen
3279 Posts |
Posted - 2005-01-16 : 18:14:52
|
| [code]select Genre, count(*) as [Movies Per Genre], ( select avg(cnt) from( select cast(count(*) as float) as cnt from Movies group by Genre) as moviecnt ) as [Avg Movies Per Genre]from Moviesgroup by Genre[/code]rockmoose |
 |
|
|
Woodzy
Starting Member
7 Posts |
Posted - 2005-01-16 : 21:10:27
|
quote: Originally posted by rockmoose
select Genre, count(*) as [Movies Per Genre], ( select avg(cnt) from( select cast(count(*) as float) as cnt from Movies group by Genre) as moviecnt ) as [Avg Movies Per Genre]from Moviesgroup by Genre rockmoose
Thanks Rockmoose, I was not even sure where to start with this! |
 |
|
|
|
|
|