java - i want to sum a column of sql table where date is current date -


i want sum values of column date today's date , pass variable. wrote following code it's not working.

error: "column name sum(bill_total) not valid." considering "sum(bill_total)" column.

string sql = "select sum(bill_total) t_report date=?"; preparedstatement pst = con.preparestatement(sql); pst.setdate(1, date); resultset rs = pst.executequery(); string sum=rs.getstring(sql); 

can tell me whats wrong query. in advance

is me or error when you're fetching result?

string sql = "select sum(bill_total) bill_total t_report date=?"; preparedstatement pst = con.preparestatement(sql); pst.setdate(1, date); resultset rs = pst.executequery(); string sum=rs.getstring("bill_total"); 

Comments

Popular posts from this blog

iOS: Performance of reloading UIImage(name:...) -

How to prevent logback from emitting repeated "Empty watch file list. Disabling" messages -

c# SetCompatibleTextRenderingDefault must be called before the first -