Hola, en realidad lo que deseo es distinto: si te das cuenta, en mi
consulta me devuelve:

Year Month Genero Cantidad
2013 1          M          145
2013  1         F           55
2013   2        M          122
2013  2         F           100

pero lo que necesito en realidad es

Year  Month  Masculino Femenino Total
2013   1         145               55           200
2013    2         122              100         222

Gracias de antemano por su ayuda,

*Aland Laines Calonge*
Twitter: @lainessolutions
Comunidad CakePHP en Español
Google+<https://plus.google.com/communities/106077549014949879129>
http://about.me/aland.laines



2014-02-05 Cesar Erices <caeri...@gmail.com>:

> SELECT date_part('YEAR',"Postulante".
> created) AS "Postulante__year", date_part('MONTH',"Postulante".created) AS
> "Postulante__month", "Persona".genero AS "Postulante__genero",
> count("Postulante".id) AS "Postulante__cuenta"
> FROM "produccion"."postulantes" AS "Postulante" LEFT JOIN
> "produccion"."personas" AS "Persona" ON ("Postulante"."persona_id" =
> "Persona"."id")
> WHERE "Postulante"."estado" = 1 AND date_part('YEAR',"Postulante".created)
> = '2013'
> GROUP BY "Persona"."genero", date_part('YEAR',"Postulante"."created"),
> date_part('MONTH',"Postulante"."created")
> ORDER BY date_part('YEAR',"Postulante".created) ASC,
> date_part('MONTH',"Postulante".created) ASC
>
>
> En la parte "Persona".genero AS "Postulante__genero" reelmplazar por CASE 
> "Persona".genero
> WHEN M THEN 'Masculino' ELSE 'Femenino' END AS "Postulante__genero"
>
>
> --
> Sin más que decir se despide de Usted, muy atentamente
>
> Cesar Erices Vergara
> Ingeniero en Gestión Informática
> Analista de Sistema
> Especialista en ISO 27001 e ITIL
>
> Cuenta Twitter: @caerices
>
> Santiago - Chile
>

Responder a