Hey everyone,
I'm struggling with something and I was wondering if someone could give me some advice.
So I have something like this:
1 - I need to calculate the car model that has the most sales. I have already written a code that calculates the most sales, but I can't figure out how to calculate the car_model for the most sales.
2 - For each car_year I need to calculate the total cars sold and then figure out the most popular year.
I'm new to this and have been struggling for days and just can't figure it out. Any help or advice would be very much appreciated.
Thanks a lot!
I'm struggling with something and I was wondering if someone could give me some advice.
So I have something like this:
Output:[{"id":1,"car":{"car_make":"Ford","car_model":"Club Wagon","car_year":1997},"price":"$5179.39","total_sales":446},
{"id":2,"car":{"car_make":"Acura","car_model":"TL","car_year":2005},"price":"$14558.19","total_sales":589},
{"id":3,"car":{"car_make":"Volkswagen","car_model":"Jetta","car_year":2006},"price":"$14879.11","total_sales":825},
{"id":4,"car":{"car_make":"Chevrolet","car_model":"Uplander","car_year":2006},"price":"$17045.06","total_sales":689},
{"id":5,"car":{"car_make":"Plymouth","car_model":"Roadrunner","car_year":1997},"price":"$14770.44","total_sales":691}]
So I have 2 questions.1 - I need to calculate the car model that has the most sales. I have already written a code that calculates the most sales, but I can't figure out how to calculate the car_model for the most sales.
2 - For each car_year I need to calculate the total cars sold and then figure out the most popular year.
I'm new to this and have been struggling for days and just can't figure it out. Any help or advice would be very much appreciated.
Thanks a lot!