I have the following query
:
SELECT
CAST(SUM(CASE WHEN s2.name LIKE '%Servidores' THEN (ta2.time_unit * 1.5)/60 ELSE ta2.time_unit/60 END) as DECIMAL(12,2)) AS TEMPO_CORRETO,
MONTHNAME(ta2.change_time) AS MES,
MONTH(ta2.change_time) AS NUMEROMES,
t2.customer_id as EMPRESA
FROM
otrs.ticket t2
LEFT JOIN otrs.time_accounting as ta2 ON t2.id = ta2.ticket_id
LEFT JOIN otrs.ticket_type as tt2 ON t2.type_id = tt2.id
LEFT JOIN otrs.service as s2 ON t2.service_id = s2.id
WHERE
ta2.change_time between '2018-01-01' AND '2018-04-30' AND
t2.customer_id = 'ZSCHIMMER SCHWARZ' AND
tt2.name = 'CONTRATO PCH'
GROUP BY
MONTHNAME(ta2.change_time),
MONTH(ta2.change_time),
EMPRESA
ORDER BY
NUMEROMES
And I'm getting the following result:
Butinmyquery
I'mselectingtheperiodfromJanuarytoApril,butinJanuaryIdonothavearecord,myneedwouldbetoreturnthefollowing:
How could I do this?