Error.. Errorrr
Esta seria la buena
Código sql:
Ver originalSELECT Referencias.referencia,
Referencias.descripcion,
"Punto Minimo",
"Punto Maximo",
("Saldo Inicial Mes"+"Entradas Mes"-"Salidas Mes") AS Saldo,
ifnull(sbc.CPM,0) AS 'CPM'
FROM Referencias LEFT JOIN
(SELECT HT.Referencia, ROUND((SUM ("Cantidad")/12),2) AS 'CPM'
FROM "Historico de Trans" AS HT
WHERE HT.Bodega = '01'
AND "Tipo Transaccion" = '17'
AND (("Anno Documento" = '2009' AND "Mes Documento" < '04' )
OR
("Anno Documento" = '2008' AND "Mes Documento" >= '04' ))
GROUP BY HT.Referencia) AS sbc
ON sbc.Referencia = Referencias.referencia
WHERE Referencias.bodega ='01'
Perdón
Quim