I am getting this error when i try to execute this piece of code. When i remove the quotes of the question marks, then it says "You have an error in your SQL syntax;" Can somebody help me to get this fixed?
String query = "select date from ticket where date >='?' and date <= '?' ";
PreparedStatement pstmt1 = con.prepareStatement(query);
pstmt1.setString(1, fromdate);
pstmt1.setString(2, todate);
pstmt1.executeQuery(query);
where date >= ? and date <= ?BETWEENclause, egWHERE date BETWEEN ? AND ?