[firebase-br] erro em select agrupavel

Cmte Wilson wilson.butigeli em itelefonica.com.br
Sex Fev 8 13:06:02 -03 2008


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





Mais detalhes sobre a lista de discussão lista