[firebase-br] erro em select agrupavel - Resolvido
Cmte Wilson
wilson.butigeli em itelefonica.com.br
Sex Fev 8 14:05:49 -03 2008
Obrigado funcionou certinho com extract
Kleber Caneva escreveu:
> Acreidto que esse Month está se referindo ao uma UDF.
>
> Mas você pode fazer com Extract
>
> case extract( month from P.dataabertura)
> When 1 then 'JANEIRO'
> When 2 then 'FEVEREIRO'
> When 5 then 'MARÇO'
> When 4 then 'ABRIL'
> ...
> When 12 then 'DEZEMBRO'
> end
>
> []´s
>
> Kléber caneva
>
> ----- Original Message -----
> From: "Cmte Wilson" <wilson.butigeli em itelefonica.com.br>
> To: "FireBase" <lista em firebase.com.br>
> Sent: Friday, February 08, 2008 12:06 PM
> Subject: [firebase-br] erro em select agrupavel
>
>
> Estou tentando fazer um select agrupando por mes mas dá erro no
> month(p.dataabertura) alegando que a expressao month nao existe.
> O erro acontece no IBExpert e no aplicativo.
>
> Linguagem VB 6 com firebird 1.5.5
>
> Abaixo o select utilizado montado em cima do exemplo retirado do livro
> firebird essencial página 20:
>
> Select
> case
> when (month(P.dataabertura) in ('01')) then 'JANEIRO'
> when (month(P.dataabertura) in ('02')) then 'FEVEREIRO'
> when (month(P.dataabertura) in ('03')) then 'MARÇO'
> when (month(P.dataabertura) in ('04')) then 'ABRIL'
> when (month(P.dataabertura) in ('05')) then 'MAIO'
> when (month(P.dataabertura) in ('06')) then 'JUNHO'
> when (month(P.dataabertura) in ('07')) then 'JULHO'
> when (month(P.dataabertura) in ('08')) then 'AGOSTO'
> when (month(P.dataabertura) in ('09')) then 'SETEMBRO'
> when (month(P.dataabertura) in ('10')) then 'OUTUBRO'
> when (month(P.dataabertura) in ('11')) then 'NOVEMBRO'
> when (month(P.dataabertura) in ('12')) then 'DEZEMBRO'
> else 'DESCONHECIDO'
> end as mes,
> sum(P.valordesconto) As Totaldesconto,
> sum(P.valorprevisto) As Totalbruto,
> count(P.*) as qtde
> from PEDIDO P
> where P.dataabertura between '01/01/2008' and '12/31/2008'
> group by 1
>
> Obrigado
> Wilson
>
>
> ______________________________________________
> FireBase-BR (www.firebase.com.br) - Hospedado em www.locador.com.br
> Para saber como gerenciar/excluir seu cadastro na lista, use:
> http://www.firebase.com.br/fb/artigo.php?id=1107
> Para consultar mensagens antigas: http://firebase.com.br/pesquisa
>
> E-mail classificado pelo Identificador de Spam Inteligente Terra.
> Para alterar a categoria classificada, visite
> http://mail.terra.com.br/cgi-bin/imail.cgi?+_u=kdcc&_l=1,1202483320.753429.11836.cadarga.hst.terra.com.br,4962,Des15,Des15
>
>
>
> ______________________________________________
> FireBase-BR (www.firebase.com.br) - Hospedado em www.locador.com.br
> Para saber como gerenciar/excluir seu cadastro na lista, use: http://www.firebase.com.br/fb/artigo.php?id=1107
> Para consultar mensagens antigas: http://firebase.com.br/pesquisa
>
>
>
>
Mais detalhes sobre a lista de discussão lista