我正在尝试从动态数据透视表中获取ResultSet值:
SELECT nomeEscola,
MAX(IF(temp_graph2.anoBase = '2012', CAST((REPROVADO)/(APROVADO+REPROVADO) AS SIGNED), NULL)) AS '2012',
MAX(IF(temp_graph2.anoBase = '2014', CAST((REPROVADO)/(APROVADO+REPROVADO) AS SIGNED), NULL)) AS '2014',
MAX(IF(temp_graph2.anoBase = '2013', CAST((REPROVADO)/(APROVADO+REPROVADO) AS SIGNED), NULL)) AS '2013'
FROM temp_graph2
GROUP BY nomeEscola
结果:
nomeEscola 2012 2014 2013
xxxxx 0,027 {null} {null}
xxxxx {null} 0,109 {null}
xxxxx {null} {null} 0,333
xxxxx {null} {null} 0,222
xxxxx {null} {null} {null}
xxxxx {null} {null} 0,083
xxxxx {null} {null} {null}
xxxxx {null} {null} 0,3
动态表我假设对象将无法识别,然后我使用结构来获取值:
for...
Object value = rstSet.getObject(i);
record.add(value);
For String工作正常,但是对于“double”值,重新调整为null。有什么想法吗?