Select mostrando o mes por extenso
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
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
Curtidas 0
Respostas
Sremulador
27/05/2009
amigo vc deve usar o WHEN
GOSTEI 0
Ocriador
27/05/2009
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.
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.
GOSTEI 0
Uelinton_reis
27/05/2009
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.
GOSTEI 0
Fausto.malheiros
27/05/2009
Caramba!!!! É exatamente isso que estou precisando...só que no interbase.
na qry não funciona :shock: :shock: :shock:
Vcs colocar isso num gen???
na qry não funciona :shock: :shock: :shock:
Vcs colocar isso num gen???
GOSTEI 0
Fausto.malheiros
27/05/2009
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.
GOSTEI 0