String fpggSql = " select count(gg.regdept)||','||substr(gg.regdept, 1, 6) from GgWgxxb gg " +
" where gg.regdate between to_date('"+ fpbegin +"', 'yyyy-mm-dd') and to_date('"+ fpend +"', 'yyyy-mm-dd') " +
" and gg.ggly like '%" + ggly + "%'" +
" and gg.mtlxzl like '%" + mt + "%'" +
" and gg.adno in ( " +
" select ad.comp_id.adno " +
" from AdCase ad " +
" where ad.casedate between to_date('"+ labegin +"', 'yyyy-mm-dd') and to_date('"+ laend +"', 'yyyy-mm-dd') " +
" ) " +
" group by substr(gg.recdept, 1, 6) " +
" having substr(gg.recdept, 1, 6) between 110101 and 110229 "; 下面错误提示。
出错,原因:, expected in SELECT [ select count(gg.regdept)||','||substr(gg.regdept, 1, 6) from com.bpcc.egov.ggjg.po.GgWgxxb gg where gg.regdate between to_date('2010-07-22', 'yyyy-mm-dd') and to_date('2010-07-23', 'yyyy-mm-dd') and gg.ggly like '%%' and gg.mtlxzl like '%%' and gg.adno in ( select ad.comp_id.adno from com.bpcc.egov.ggjg.po.AdCase ad where ad.casedate between to_date('2010-07-22', 'yyyy-mm-dd') and to_date('2010-07-23', 'yyyy-mm-dd') ) group by substr(gg.recdept, 1, 6) having substr(gg.recdept, 1, 6) between 110101 and 110229 ]
" where gg.regdate between to_date('"+ fpbegin +"', 'yyyy-mm-dd') and to_date('"+ fpend +"', 'yyyy-mm-dd') " +
" and gg.ggly like '%" + ggly + "%'" +
" and gg.mtlxzl like '%" + mt + "%'" +
" and gg.adno in ( " +
" select ad.comp_id.adno " +
" from AdCase ad " +
" where ad.casedate between to_date('"+ labegin +"', 'yyyy-mm-dd') and to_date('"+ laend +"', 'yyyy-mm-dd') " +
" ) " +
" group by substr(gg.recdept, 1, 6) " +
" having substr(gg.recdept, 1, 6) between 110101 and 110229 "; 下面错误提示。
出错,原因:, expected in SELECT [ select count(gg.regdept)||','||substr(gg.regdept, 1, 6) from com.bpcc.egov.ggjg.po.GgWgxxb gg where gg.regdate between to_date('2010-07-22', 'yyyy-mm-dd') and to_date('2010-07-23', 'yyyy-mm-dd') and gg.ggly like '%%' and gg.mtlxzl like '%%' and gg.adno in ( select ad.comp_id.adno from com.bpcc.egov.ggjg.po.AdCase ad where ad.casedate between to_date('2010-07-22', 'yyyy-mm-dd') and to_date('2010-07-23', 'yyyy-mm-dd') ) group by substr(gg.recdept, 1, 6) having substr(gg.recdept, 1, 6) between 110101 and 110229 ]
yyyy-MM-dd
原因:, expected in SELECT [.......]
不知道 lz 用的是 什么数据库substr 在数据里面 貌似不能执行吧