I need to compare the StatusID's of a job in the last 12 hours. If the value is over 50%, an alert is created.
select StatusID, count(statusid) as [count]
from job nolock
where jobtypeid = 5033
and ModifiedOn > CONVERT(datetime,dateadd(hh,-12,getdate()),104)
group by statusid
order by 1 desc
This gives me my results, but I need it as part of:
CASE WHEN "Count(StatusID = 5 > 50%)" THEN ''GREEN'' ELSE ''RED''
How can I turn the top select into a Case?
