Buenas,
Prueba Asi:
Código SQL:
Ver originalSELECT COUNT(prodescuadria)
FROM esquemaprograma AS ep INNER JOIN simulaciones AS s ON (ep.profolio = s.profolio AND ep.esqcodigo=s.esqcodigo AND ep.patcodigo=s.patcodigo)
INNER JOIN produccionsimulada AS ps ON s.simcodigo=ps.simcodigo
WHERE
ep.profolio='$variable' AND
s.patcodigo='A24' AND
prodtipo!='C'
GROUP BY
prodescuadria;
Saludos