GARANTIR DESCONTO

Fórum Select mostrando o mes por extenso #60657

27/05/2009

0

Bom dia Amigos

Estou fazendo o select abaixo para mostrar a qtde de orcamentos enviados no mes.

Obs.: Estou utilizando o firebird 2.0

[b:1f5f1a5110]SELECT COUNT(*) as TOTAL, extract(month from DATA_STATUS_ORC) AS MES FROM ORC
WHERE extract(year from DATA_STATUS_ORC) = 2009
GROUP BY MES[/b:1f5f1a5110]

Mas preciso que o mes apareça por extenso. Exemplo: Jan, Fev, Mar, Abr ou
Janeiro, Fevereiro, Março, Abril.

Teria como fazer isto?
Como devo fazer?

Obrigado.

Uelinton


Uelinton_reis

Uelinton_reis

Responder

Posts

27/05/2009

Sremulador

amigo vc deve usar o WHEN


Responder

Gostei + 0

27/05/2009

Ocriador

Fiz assim no mysql
CASE MONTHNAME(data)
when ´January´ then ´Janeiro´
when ´February´ then ´Fevereiro´
when ´March´ then ´Março´
when ´April´ then ´Abril´
when ´May´ then ´Maio´
when ´June´ then ´Junho´
when ´July´ then ´Julho´
when ´August´ then ´Agosto´
when ´September´ then ´Setembro´
when ´November´ then ´Novembro´
when ´December´ then ´Dezembro´
END as mesDescritivo

Deve ajudar.


Responder

Gostei + 0

28/05/2009

Uelinton_reis

Fiz assim no mysql CASE MONTHNAME(data) when ´January´ then ´Janeiro´ when ´February´ then ´Fevereiro´ when ´March´ then ´Março´ when ´April´ then ´Abril´ when ´May´ then ´Maio´ when ´June´ then ´Junho´ when ´July´ then ´Julho´ when ´August´ then ´Agosto´ when ´September´ then ´Setembro´ when ´November´ then ´Novembro´ when ´December´ then ´Dezembro´ END as mesDescritivo Deve ajudar.


Caro amigo, abrigado pela ajuda.
Estou enviando o resultado aqui. Pode ajudar alguem...


SELECT COUNT(*) as TOTAL, extract(month from DATA_STATUS_ORC) AS MES,
case extract(month from DATA_STATUS_ORC)
when 1 then ´Janeiro´
when 2 then ´Fevereiro´
when 3 then ´Março´
when 4 then ´Abril´
when 5 then ´Maio´
when 6 then ´Junho´
when 7 then ´Julho´
when 8 then ´Agosto´
when 9 then ´Setembro´
when 10 then ´Outubro´
when 11 then ´Novembro´
when 12 then ´Dezembro´
end AS MESDESC FROM ORC
WHERE extract(year from DATA_STATUS_ORC) = 2009
GROUP BY MES

Obrigado.


Responder

Gostei + 0

06/08/2009

Fausto.malheiros

Caramba!!!! É exatamente isso que estou precisando...só que no interbase.

na qry não funciona :shock: :shock: :shock:

Vcs colocar isso num gen???


Responder

Gostei + 0

06/08/2009

Fausto.malheiros

Caramba!!!! É exatamente isso que estou precisando...só que no interbase. na qry não funciona :shock: :shock: :shock: Vcs colocar isso num gen???


Da erro no group by.


Responder

Gostei + 0

Utilizamos cookies para fornecer uma melhor experiência para nossos usuários, consulte nossa política de privacidade.

Aceitar