Hola a todos.

Soy novato en postgresql, tengo una vista con los campos 
        id int
        fecha date
        total numeric

agrupo por meses mediante la consulta :

select date_part('year',w.fecha) as año , date_part('month'::text,
w.fecha)as mes, sum(w.total) as total_mes
   from w_totalalbaran w  where w.fecha between '25-08-1998' and
'31-12-1999' 
    group by date_part('year',w.fecha), 
   date_part('month'::text, w.fecha) order by 1,2

o por años:

select date_part('year',w.fecha) as año , sum(w.total) as total_mes
   from w_totalalbaran w  where w.fecha between '25-08-1998' and
'31-12-1999' 
    group by date_part('year',w.fecha)order by 1,2

quiero una consulta que me de totales de meses y años, no se como
hacerlo.
 
un saludo Angel 

--
TIP 10: no uses HTML en tu pregunta, seguro que quien responda no podr� leerlo

Responder a