account_id current_balance opening_date 1 100 2012-03-01 2 100 2012-4-01 3 100 2013-03-1
现在当我在 sql work bench 中运行查询时很好
select count(acc.account_id)
from daily_account acc
where acc.opening_date < '2013-03-01'
但是当我在 NetBeans 中运行它时,它没有给出正确的输出。
select count(acc.account_id)
from daily_account acc
where acc.opening_date < '"+ new Date((Integer.parseInt(FromYearComboBox.getSelectedItem().toString())-1900),FromMonthComboBox.getSelectedIndex(),Integer.parseInt(FromDateComboBox.getSelectedItem().toString()))).toString()
谁能帮助我为什么会这样?
编辑 :
rs = st.executeQuery("select count(acc.account_id) from daily_account
acc where acc.opening_date < '"+ new
Date((Integer.parseInt(FromYearComboBox.getSelectedItem().toString())-1900),FromMonthComboBox.getSelectedIndex(),(Integer.parseInt(FromDateComboBox.getSelectedItem().toString()))).toString()+"';");
rs.next();
tabledata[0][2]=rs.getString(1);
编辑::它给了我错误的答案......它正在计算所有的帐户ID......