SHARE
TWEET

Untitled

a guest Jun 12th, 2019 70 in 2 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. String sql = "select sum((case when ( q01 is not null and  q01 != '*') and ( correta01 is not null and  correta01 != '*')    
  3.      then cast(( q01 = correta01 ) as int) else 0 end)) acertos,    
  4. sum((case when ( q01 is not null and  q01 != '*') and ( correta01 is not null and  correta01 != '*')    
  5.       then cast(( q01 != correta01 ) as int) else 0 end)) erros    
  6. from tabela"
  7.  
  8. // RETORNO DO BANCO DE DADOS
  9. ACERTOS | ERROS
  10.   10    |  12
  11.  
  12. // NA JPA FAÇO O SEGUINTE
  13.  
  14. Object[] resultadoQuery = (Object[]) queryAcertosErros.getSingleResult();
  15.  
  16. Integer acertos = ( (BigInteger) resultadoQuery[0]).intValue();
  17. Integer integer = ( (BigInteger) resultadoQuery[1]).intValue();
  18.  
  19. // RESULTADO NA APLICAÇÃO
  20. acertos = 0
  21. erros   = 22
  22.  
  23. // ERRO: Toda a soma vai pra segunda posição do retorno no banco de dados
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