I have a query running on my site that has Mysql 5.5.43
installed, but when I went up on the server (which has MariaDB 5.5.38
and I only know it now) the query does not return the same result, I would like to know if anyone could tell me why this wrong result and the differences between these two databases, although they are very similar, have their differences, or am I wrong?
Here is an example of the query I am trying to run, remembering that in Mysql it returns the correct results and in MariaDB it is on the server that does not:
SELECT DISTINCT umr.tema_id,
(
SELECT count(vw1.tema_id)
FROM vw_unidades_monitoramentos_respostas vw1
WHERE ((vw1.tema_id = umr.tema_id)
AND (vw1.unidade_id = 68)
AND (vw1.opt_aplicavel = 1)
AND (vw1.opt_conforme = 1)
AND (vw1.dt_validate >= '2015-07-22'))
) as conforme,
(
SELECT count(vw2.tema_id)
FROM vw_unidades_monitoramentos_respostas vw2
WHERE ((vw2.tema_id = umr.tema_id)
AND (vw2.unidade_id = 68)
AND (vw2.opt_aplicavel IS NULL))
) as naoAvaliado,
(
SELECT count(vw3.tema_id)
FROM vw_unidades_monitoramentos_respostas vw3
WHERE ((vw3.tema_id = umr.tema_id)
AND (vw3.unidade_id = 68)
AND (vw3.opt_aplicavel = 1 OR vw3.opt_aplicavel IS NULL))
) as totalAtribuido
FROM vw_unidades_monitoramentos_respostas umr
WHERE (umr.unidade_id = 68 AND (umr.opt_aplicavel = 1 OR umr.opt_aplicavel IS NULL))
Here is a print that I took out of the results by running this query on both bases and see the difference between the two banks, remembering that the data is the same.
Linktoadumpinthedatabasetobetested. link