Jump to content

need help please


shaf

Recommended Posts

I have table customer in which, one of the columns is start_Date of data type Date. I've tried running it but no rows were selected. I wonder if it is because my queries were wrong.So here, I wanted to create a monthly and yearly report which takes input("month" and "year") from the user.

 

------------------------------------------------------------------------------------------------------------------------------------------------------------------------

String year = request.getParameter("year"); String month = request.getParameter("month");String query = "SELECT EXTRACT(YEAR FROM start_Date) AS start_Year," + "EXTRACT(MONTH FROM start_Date) AS start_Month, " + "FROM customer"; statement = con.createStatement(); ResultSet result = statement.executeQuery(query); while (result.next()) { String query4 = "SELECT * FROM customer WHERE status_Order='Paid'" + ",start_Month='" +month+ "' AND start_Year='" +year+ "'"; statement4 = con4.createStatement(); ResultSet rs4 = statement4.executeQuery(query4);

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...