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.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Count occurrence of records

Author  Topic 

grimmus
Yak Posting Veteran

53 Posts

Posted - 2012-01-19 : 11:50:32
Hi,

I need to count how many instrumental songs are on a selection of albums

My output needs to be album title and then the number of occurrence's of instrumental songs for that particular album.

I am confused how i can get the sum of each album and then output each album title followed by the number of occurrences of instrumental songs.

I was thinking of using a WITH statement to count the occurrences but then i was confused how to join this table and output the values.

Album Title---# Songs
Title 1-------4
Title 2-------0
Title 3-------9
Title 4-------1
Title 5-------15

Thank you in advance for any tips.

ehorn
Master Smack Fu Yak Hacker

1632 Posts

Posted - 2012-01-19 : 12:02:41
Hello grimmus,

If you would, please provide a sample table structure and small set of data which highlights you problem and I am sure someone can help.

TIA.
Go to Top of Page
   

- Advertisement -