declare quxian int;        
select count(1) into c from com_area where areaName like '%quxian%';
报错了 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 'select count(1) into c from com_area where areaName like '%'+quxian+'%';
      ' at line 11

解决方案 »

  1.   

        改成这样试下:
    select count(1) into @c from com_area where areaName like '%quxian%';
    select @c;
      

  2.   

    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 'select count(1) into c from com_area where areaName like '%'+quxian+'%';
          ' at line 11
    很显然你的语句并不是   where areaName like '%quxian%';
    建议提问时尽量贴原语句。改成 select count(1) into c from com_area where instr(areaName,quxian);