Retrieving %data from sqlite database java -
so have 2 database table in sqlite: vendororder
, newspaperorder
.
vendororder
db table has (no,date,vendor, ...) column (no
id#).
date no vendor ... 06:57:05 pm 27/07/2017 1 09:18:23 28/07/2017 2 b 09:19:08 28/07/2017 3 c
newspaperorder
db table has (no,newspaper,orders,subtotal, ...) column.
no newspaper orders subtotal rebate... 1 bulletin 3 9 1 m times 1 5 1 philstar 2 20 2 bulletin 0 0 2 m times 3 15 2 philstar 0 0 3 bulletin 1 9 3 m times 4 20 3 philstar 5 50
i able retrieve data specific date, using code.
string sql = "select vendororder.vendor,newspaperorder.newspaper,newspaperorder.orders,newspaperorder.subtotal,newspaperorder.rebate" +" vendororder,newspaperorder" +" vendororder.no = newspaperorder.no , newspaperorder.newspaper='bulletin'" +" , vendororder.date '%"+x+"' order vendororder.date" +""; pst = sqliteconn.preparestatement(sql); rs = pst.executequery(); reporttable.setmodel(dbutils.resultsettotablemodel(rs)); rs.close(); pst.close();
then now, trying specific date range, aware there syntax
"select * summarizedreport data_id between '"+data1+"' , '"+data2+"' order data_id"
this last code wrote (its not working lol haha)
string sql = "select vendororder.vendor,newspaperorder.newspaper,newspaperorder.orders,newspaperorder.subtotal,newspaperorder.rebate" +" vendororder,newspaperorder" +" vendororder.no = newspaperorder.no , newspaperorder.newspaper='bulletin'" +" , vendororder.date between '%"+x+"' , '%"+y+"' order vendororder.date" +""; pst = sqliteconn.preparestatement(sql); rs = pst.executequery(); reporttable.setmodel(dbutils.resultsettotablemodel(rs)); rs.close(); pst.close();
Comments
Post a Comment