Question: This question is for SQL . The below SQL code generates a report of all the car models put in the assigned states within the
This question is for SQL
The below SQL code generates a report of all the car models put in the assigned states within the last day.
Could you please help modify the below SQL code to also include the names of the models tied to each state?
SELECT
'UNSCHEDULEDMAINT' AS STATE, COUNT AS ModelsCount
FROM
Models List
WHERE
state in 'UNSCHEDULEDMAINT'
AND downdate CURRENTDATE INTERVAL day
UNION ALL
SELECT
'SCHEDULEDMAINT' AS STATE, COUNT AS ModelsCount
FROM
Models List
WHERE
state in 'SCHEDULEDMAINT'
AND downdate CURRENTDATE INTERVAL day
UNION ALL
SELECT
'Running' AS state,
COUNT AS Modelscount
FROM
Models List
WHERE
state 'Running'
AND downdate CURRENTDATE INTERVAL day;
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
