If there is no record, then there is no way to return this query '0' in the Grade column? Now when nothing is found I get an empty line.
Select COALESCE (score, 0) as the score, choose COALESCE (grade, 0) grade, LAST_UPDATE, as 'Dummy' (as the case ScanName when the 'system =' network system '' then '=' the network system ''), the amount of the amount (the case (when the matter is serious when 1 then 10 then 9 when 3 then 6 when 4 then 4 then 3 end) / COUNT (severity) In the form of score, (amount (case seriously when 1 then 10 when 2 then 9 when 3 then 6 when 4 then 3 end) / COUNT (severity) grade, from missing_internal to LAST_UPDATE where '% APP%' and LAST_UPDATE & Gt; ScanName; = SUBDATE (Select Max (missing_internal to LAST_UPDATE), interval 1 day) No NULL limit1 Union Score Select all as NULL, grade, 0 as LAST_UPDATE, as' Dummy Order by LAST_UPDATE DESC As is zero) 1 limit as T2; The numbers and grades are similar to the purpose because I am using a different script to put the score to a letter grade.
Take a look at the function ...
If I ask your question well If it is understood in the way, then the following question should be done exactly what you want (the rows are returned when there is zero):
select COALESCE (score, 0) score As in the form of COALESCE (grade, 0) grade, as LAST_UPDATE (selection (case ScanName when 'APP' then 'network system' end), (amount (case Seriousness when 1 then 10 when 2 then 9 when 3 then 6 when 4 then 3 end) / COUNT (severity) as score, (zodiac (case seriousness when 1 then 10 when 2 then 9 when 3 to 6 then 4 then 3 EDD) / COUNT (Severity) AS GRADE, LAST_UPDATE to missing_internal WHERE '% APP%' and LAST_UPDATE & gt; = ScanName as SUBDATE (choose from missing_internal MAX (LAST_UPDATE, INTERVAL 1 day) Hover system faucet is not limited 1 Union Select All, tap as zero, grade as zero, LAST_UPDATE by command LAST_UPDATE as DESC) 1 limit as T2; I have not tested the query, so you may need to organize it ... though take the idea ...
If you only have zero You want to get a column return blank result, as you can use it with the example given above:
COALESCE (amount (case seriously when 1 to 10 when 2 and 9 ie 3 and 6 then 4 3) / COUNT (severity), 0) AS grade
Comments
Post a Comment