daily pastebin goal
17%
SHARE
TWEET

Untitled

a guest Jul 12th, 2018 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SELECT  'Urbana' as col1
  2.     ,pCategoria.ds_val_opcao as categoria
  3.     ,count(ac.id_acidente) as qtd_acidente
  4. FROM    acidente ac
  5.     right join parametros pCategoria
  6.     on (pCategoria.cd_tabela like 'categoria_acidente'and cast(pCategoria.cd_opcao as varchar(255)) like cast(ac.categoria as varchar(255)))
  7.     and extract(month from ac.dt_acidente) = 09
  8.     and extract(year from ac.dt_acidente) = 2009
  9.     and ac.area = 2
  10. WHERE   pCategoria.cd_tabela = 'categoria_acidente' and pCategoria.cd_opcao not like '6'
  11. GROUP BY pCategoria.ds_val_opcao
  12. UNION
  13.  
  14. SELECT  'Rural' as col2
  15.     ,pCategoria.ds_val_opcao as categoria
  16.     ,count(ac.id_acidente) as qtd_acidente
  17. FROM    acidente ac
  18.     right join parametros pCategoria
  19.     on (pCategoria.cd_tabela like 'categoria_acidente'and cast(pCategoria.cd_opcao as varchar(255)) like cast(ac.categoria as varchar(255)))
  20.     and extract(month from ac.dt_acidente) = 09
  21.     and extract(year from ac.dt_acidente) = 2009
  22.     and ac.area = 1
  23.    
  24. WHERE   pCategoria.cd_tabela = 'categoria_acidente' and pCategoria.cd_opcao not like '6'
  25. GROUP BY pCategoria.ds_val_opcao
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top