日期:2014-05-17  浏览次数:20865 次

SQL问题求助
sql4   =   "select   sum(aid_amount)   from   t_grant_city ";
sql4   += "where   apply_id   like   ' "+((String)unitids.elementAt(i)).substring(0,6)+ "% '   ";
sql4   += "and   substr(pay_date,0,7)   > =   ' "+s_date2+ " '   and     substr(pay_date,0,7)   <=   ' "+s_date+ " ' ";

rs4=stmt3.executeQuery(sql4);后
说SQL没有准确结束。请帮帮忙   sql3能执行
sql3   = "select   sum(aid_amount)   from   t_grant_city   ";
sql3   += "where   apply_id   like   ' "+((String)unitids.elementAt(i)).substring(0,6)+ "% '   and   substr(pay_date,0,7)= ' "+s_date+ " ' ";

------解决方案--------------------
sql4 = "select sum(aid_amount) from t_grant_city ";
------解决方案--------------------
bobfang(匆匆过客) ( ) 信誉:120
sql4 = "select sum(aid_amount) from t_grant_city ";
强,你是在少了个空格,把t_grant_city与where 粘在一起了