首页 > sql 报错]SQL Error: 1064, SQLState: 42000

sql 报错]SQL Error: 1064, SQLState: 42000

sql语句:

String queryString="SELECT c.pubid, c.type,c.fetch_num,d.category_name,c.couponname,c.couponfee/100 as couponfee,c.pic1_path as pic1Path,IF(ISNULL(r.minfee) || LENGTH(trim(r.minfee))<1,r.maxfee,r.minfee) fee,sc.id,";
                queryString+="ifnull((SELECT min(round(6378.138 * 2 * asin(sqrt(pow(sin(("+positionNS+" * pi() / 180 - s.positionNS * pi() / 180) / 2),2) + cos("+positionNS+" * pi() / 180) * cos(s.positionNS * pi() / 180) ";
                queryString+=" * pow(sin(("+positionWE+"* pi() / 180 - s.positionWE * pi() / 180) / 2),2))),2)) AS distance";
                queryString+="FROM couponpublish c,hh_coupons_category d,couponpool e,ruledescribe r,actionrule ru, shop_cart sc,market s,saas m WHERE s.saas = m.id AND s.saas = ru.saas ) ,0) distance and d.id=c.category_id and e.owner='"+userId+"' and e.pubid=c.pubid and c.getruleid=r.ruleid and r.actionfile=ru.actionfile and sc.pub_id = c.pubid";

报错:[org.hibernate.engine.jdbc.spi.SqlExceptionHelper]SQL Error: 1064, SQLState: 42000
[org.hibernate.engine.jdbc.spi.SqlExceptionHelper]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'where e.owner='4028668150c6aedb0150c6ddde750005' and e.pubid=c.pubid limit 6' at line 1
[org.jeecgframework.core.common.exception.GlobalExceptionResolver]全局处理异常捕获:
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'where e.owner='4028668150c6aedb0150c6ddde750005' and e.pubid=c.pubid limit 6' at line 1

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

百度查了下是占用mysql关键字?占用哪个了?


如其所言是语法有错,但是报错里引用的片断与你给出的代码不符。请检查它执行的语句到底是从哪里来的……

【热门文章】
【热门文章】