Inconveniente con agrupacion de datos

(1/1)

joalbela:
Buenas noches

Me gustaria que me ayudaran con el inconveniente que estoy presentando, tengo la siguiente consulta pero me esta trayendo los registros repetidos, necesito que solo me traiga un registro de cada noimbre de compaņia


SELECT DISTINCT  C.NOMBRES,
CASE Month(v.fecha) when  '1' THEN ROUND(SUM(v.valor_total),0) end enero,
CASE Month(v.fecha) when  '2' THEN ROUND(SUM(v.valor_total),0) end Febrero,
CASE Month(v.fecha) when  '3' THEN ROUND(SUM(v.valor_total),0) end Marzo,
CASE Month(v.fecha) when  '4' THEN ROUND(SUM(v.valor_total),0) end Abril,
CASE Month(v.fecha) when  '5' THEN ROUND(SUM(v.valor_total),0) end Mayo,
CASE Month(v.fecha) when  '6' THEN ROUND(SUM(v.valor_total),0) end Jumio
FROM CLIENTES C  JOIN VENTAS V on C.NIT=V.NIT
WHERE   Month(v.fecha)  between '2'and '6'
GROUP BY C.NOMBRES, Month(v.fecha)
ORDER BY C.NOMBRES

Muchas gracias

Navegación

[0] Índice de Mensajes