I am using ms access DB. I need to obtain sale by date.
Here is my table specification:
BILL_NO DATE SALE
1 8/30/2010 1000
2 8/30/2010 2000
3 8/31/2010 3000
4 8/31/2010 2000
If i want the sale for 8/31/2010 it should return 5000.
I have inserted Date values using java.sql.Date object in DB.
Noted should be that
DATEis a reserved keyword in MS Access. You need to specify it with braces. Further, you’d like to useSimpleDateFormatto convert a human readable date string to a fullworthyjava.util.Dateobject which you in turn can construct ajava.sql.Datewith which in turn can be set in thePreparedStatementthe usual way.Here’s a kickoff: