I’m working with a DVD rental database and I’m trying to find which category of DVD is rented the most each month, without caring about year. I’ve made a detailed table already that contains each rental in the database and it’s rental id, rental month, inventory id, and category. I’m hoping to take the information from the detailed table and create a summary table that has a column for the 12 months and columns that show what the most popular category in that month was as well as how many total rentals that month had and how many of them were in the most popular category.
I’ve tried to use a loop to sort through the 12 months because I was hoping to avoid having to write the same code 12 times. I can’t seem to get the loop to work right though and I’m not even sure if it’s the direction I should be taking. Is there a more effective way to get what I’m looking for?
current attempt at a loop to solve my problem
ThatOnePerson1029 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.