0
I have two queries in the database that work independently, but now the need to join them in a single script
.
I made some attempts, but without success. Who can help me, I would very much appreciate.
SELECT 1:
SELECT COUNT(codticket),
usuario
FROM vw_tkt_total
INNER JOIN usuarios ON codusuario = id
WHERE anofechamento = '$ano'
AND STATUS IN (3, 13)
AND ativo = '1'
GROUP BY usuario DESC
ORDER BY COUNT(codticket) DESC
SELECT 2:
SELECT COUNT(codticket),
usuario
FROM vw_tkt_total
INNER JOIN usuarios ON codusuario = id
WHERE anoabertura = '$ano'
AND STATUS IN (1, 2, 4)
AND ativo = '1'
GROUP BY usuario DESC
ORDER BY COUNT(codticket) DESC
Changes the status condition of one to the other beyond a catch closing year and another opening year.
From what you’re saying, it seems to be the case mark an answer as accepted. Here we do not write "solved" in the question. If you have an answer that really helped you, mark it as accepted. If you came to the solution on your own, put in the solution as an answer. So content is more organized and easier to find in the future by other people with similar problems.
– Sorack