Testa assim::

select
x.total

from
(



SELECT

  count(*) as total

FROM

    receber

WHERE

    reccliente = 5444 and

    extract(year from recdatavencimento) = '2011'

GROUP BY

  CASE

   WHEN recpago = 1 then 'Pago'

   WHEN recpago = 0 then 'Aberto'

  END

)x


Em 26 de setembro de 2012 14:24, Paulo <[email protected]>escreveu:

> Ola pessoal,****
>
> Tenho a seguinte sentença:****
>
> ****
>
> SELECT****
>
>   count(*) ****
>
> FROM ****
>
>     receber****
>
> WHERE        ****
>
>     reccliente = 5444 and ****
>
>     extract(year from recdatavencimento) = '2011' ****
>
> GROUP BY****
>
>   CASE****
>
>    WHEN recpago = 1 then 'Pago'****
>
>    WHEN recpago = 0 then 'Aberto'****
>
>   END ****
>
> ** **
>
> RETORNA O SEGUINTE REGISTROS:****
>
> 14 pago****
>
> 22 aberto****
>
> ** **
>
> Preciso na mesma sentença retornar o total dos registros: ****
>
> Ex:****
>
> 14 pago****
>
> 22 aberto****
>
> 36 total****
>
> ** **
>
> Alguém tem alguma ideia ¿****
>
> ** **
>
> Att,****
>
> Paulo.****
>
> ** **
>
> _______________________________________________
> pgbr-geral mailing list
> [email protected]
> https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral
>
>


-- 
- Att.
- Marcelo.
_______________________________________________
pgbr-geral mailing list
[email protected]
https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral

Responder a