This question has been answered before here but the solutions that were posted are not working for me. Following is my code:
Statement query = this.conn.createStatement();
ResultSet resultSet = query.executeQuery("Select COUNT(*) FROM Questions AS total");
resultSet.next();
int totalQuestions = resultSet.getInt("total");
System.out.println(totalQuestions);
System.exit(1);
resultSet.close();
It just keeps on saying column total not found. I have tried it without "resultSet.next()" as well but same issue. I have also tried resultSet.getInt(1) but that doesn't work either.
ResultSet resultSet = query.executeQuery("Select COUNT(*) AS total FROM Questions");and you are done....