Question: This question is for SQL I am trying to create an SQL query that can pull out the number car models that went down for
This question is for SQL I am trying to create an SQL query that can pull out the number car models that went down for maintenance on a day andthe number of models fixed on a day. The data needs to be organized by day and goes back a month from the present date.Below is the code I have. "UNSCHEDULEDDOWN" and SCHEDULEDDOWN are the two maintenance states and RELEASED is the fixed state SELECT ModelID STATE, UPDATEDDATE, COUNT AS ModelCOUNTFROM CarModelListWHERE state in UNSCHEDULEDDOWN', 'SCHEDULEDDOWN', 'RELEASED' AND updateddate CURRENTDATE INTERVAL dayGroup By ModelID STATE, UPDATEDDATEorder byUPDATEDDATE DESC; The main problem I am having is that I need to organize the pulled data to transfer it to a bar graph.The bar graphs horizontal axis is for the days and the vertical axis is for the number of cars.There needs to be two bars for each day, one for the number of cars brought down that day and one for the number of cars fixed on that day.I am using Excels chart functionality to create the bar graph. Is there a better SQL statement that can be used to accomplish this?
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
