I NEED TO CONDITION THE FILTER OF MY QUERY WITH A WHEN CONDITION IN WHERE SECTION...IT DOESN'T WORK...HOW COULD I DO FOR...?
SELECT CM.IdCaja,CM.IdValor,CM.Fecha,CM.Hora,CM.NúmeroComprobante,CM.Monto,CM.Observaciones,Cajas.Nombre as CajNom,COM.Descripción as ComDesc
FROM CajasMovimientos CM
LEFT JOIN Cajas ON CM.IdCaja=Cajas.IdCaja
LEFT JOIN Comprobantes COM ON CM.IdComprobante=COM.IdComprobante
WHERE 1>0 AND CM.Monto>0 AND
CASE LEN(Cajas.IdValor)=0 THEN
CM.Monto<0
ELSE
CM.Total>=0
END
OREDER BY CM.Fecha
SELECT CM.IdCaja,CM.IdValor,CM.Fecha,CM.Hora,CM.NúmeroComprobante,CM.Monto,CM.Observaciones,Cajas.Nombre as CajNom,COM.Descripción as ComDesc
FROM CajasMovimientos CM
LEFT JOIN Cajas ON CM.IdCaja=Cajas.IdCaja
LEFT JOIN Comprobantes COM ON CM.IdComprobante=COM.IdComprobante
WHERE 1>0 AND CM.Monto>0 AND
CASE LEN(Cajas.IdValor)=0 THEN
CM.Monto<0
ELSE
CM.Total>=0
END
OREDER BY CM.Fecha