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. "UNSCHEDULED_DOWN" and SCHEDULED_DOWN are the two maintenance states and RELEASED is the fixed state SELECT Model_ID, STATE, UPDATED_DATE, COUNT(*) AS Model_COUNTFROM Car_Model_ListWHERE state in ('UNSCHEDULED_DOWN', 'SCHEDULED_DOWN', 'RELEASED') AND updated_date >= CURRENT_DATE - INTERVAL '30' dayGroup By Model_ID, STATE, UPDATED_DATEorder byUPDATED_DATE 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 blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!