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+"'";

解决方案 »

  1.   

    请您帮我看看sql4语法上写的对吗?谢谢
      

  2.   

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

  3.   

    你用你的程序debug出来的SQL,然后你可以把这个SQL直接在数据库上运行看有没有问题
      

  4.   

    说没有准确结束,DEBUG上面出不来QSL呀,你帮我看看时间的比较对不对呀?
      

  5.   

    sql4 = "select sum(aid_amount) from t_grant_city ";
      

  6.   

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