Ver Mensaje Individual
  #1 (permalink)  
Antiguo 07/06/2009, 22:21
juanf03
 
Fecha de Ingreso: enero-2008
Mensajes: 125
Antigüedad: 16 años, 4 meses
Puntos: 0
Query sum en un case

Que tal, tengo algo muy simple, quiero que me sume el importe de algo, y en caso de ser 0 que ponga 0, sino que me muestre el valor, pero me tira error de sintaxis

select cate_descripcion,case when sum(reci_cant*reci_importe)=0 then 0
else sum(reci_cant*reci_importe)
from Categorias,Legajo_grupo,Recibos,Liquidacion
where cate_codigo=legr_categoria and legr_grupo=reci_grupo
and legr_legajo=reci_legajo and reci_liqi_numero=liqi_numero
and liqi_fecha_firme is not null
group by cate_codigo,cate_descripcion

me dice

Msg 156, Level 15, State 1, Line 3
Sintaxis incorrecta cerca de la palabra clave 'from'.

saben que puede ser?