The console gives me the following error:
FUNCTION workday. SUM does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
Can only sql be in my prepareStatement, help me!
Dao method
public List<ViagemBean> getListaTotalDiaria(String totalDiaira) {
try {
List<ViagemBean> viagens = new ArrayList<ViagemBean>();
ConexaoMySQL.conectar();
PreparedStatement stmt = ConexaoMySQL.getConexao()
.prepareStatement("select SUM (valorDiaria) as total from viagem where colaborador = ? ");
stmt.setString(1, totalDiaira);
ResultSet rs = stmt.executeQuery();
while (rs.next()) {
// criando o objeto viagem
ViagemBean viagem = new ViagemBean();
viagem.setValorDiaria(rs.getDouble("total"));
// adicionando o objeto à lista
viagens.add(viagem);
}
rs.close();
stmt.close();
return viagens;
} catch (SQLException e) {
throw new RuntimeException(e);
}
}