-1
They work perfectly, but now I need to join them, but the results will be different or I can not join the result, but rather join the SQL and get the result of the two below, but I do not know how to do.
Look what I got:
SELECT COUNT(a.arquivada=1)AS orden, c.nomeCliente
FROM tbl_os o
INNER JOIN tbl_clientes c
ON(o.tecnico = c.id)
WHERE o.arquivada=1
AND o.tecnico=1
AND DAY(o.dataSaida)=x
AND MONTH(o.dataSaida) = x
SELECT SUM(a.idTipoAtendimento=1) AS sistema, SUM(a.idTipoAtendimento=2)AS servico, c.nomeCliente
FROM tbl_Atendimento a
INNER JOIN tbl_clientes c
ON(a.tecnico = c.id)
WHERE a.arquivada=1
AND a.tecnico=1
AND DAY(a.dataMarcada)=x
AND MONTH(a.dataMarcada) = x
Are you sure these selects work without the GROUP BY clause?
– Reginaldo Rigo
What do you mean join without joining? And I can’t see "they’re in bold"
– Ricardo da Rocha Vitor
http://forum.imasters.com.br/topic/555805-sql-com-2-where-ou-algo-assim/#entry2216981
– Motta
Oops, I’m new here, I had the bold, but it didn’t come out. , so these SELECT works separately, but I need the COUNT and SUM value that are in them. need to join the columns in the same SQL, so far I haven’t found anything.
– user3129685