I set a SELECT
to return some information from my separate table by time and date. Until that part everything is working correctly. Now I need it to select the same data only from another date, which is the same table.
My SELECT
:
SELECT CONCAT('2015-07-27 ', Horas.Hora, ':00:00') as HORA, qtd_clique as CLIQUES, qtd_ligacoes as LIGACOES, qtd_form as FORM
FROM (
SELECT '08' Hora UNION SELECT '09' UNION SELECT '10' UNION SELECT '11' UNION
SELECT '12' UNION SELECT '13' UNION SELECT '14' UNION SELECT '15' UNION
SELECT '16' UNION SELECT '17' UNION SELECT '18'
) Horas
LEFT JOIN relatorio_cliques C
ON SUBSTRING(C.data_hora, 12, 2) = Horas.Hora
AND C.data_hora LIKE '2015-07-27%'
AND C.cliente = 'cliente_teste'
GROUP BY CONCAT('2015-07-27 ', Horas.Hora, ':00:00')
ORDER BY 1;
The retro of this were:
HORA | CLIQUES | LIGACOES | FORM
I have the 3 columnar CLIQUES, LIGACOES and FORM of the date 2015-07-27, now would need the same information only from the day 2015-07-26, for example.
The return would look something like this:
HORA | CLIQUES(27-07) | CLIQUES(26-07) | LIGACOES(27-07) | LIGACOES(26-07) | FORM (27-07) | FORM (26-07)
I tried but I could not, if someone could help, I would be very grateful.