查询公司职工数sql语句:
select umOrg.*,(select count(0) from umStaff where bcfl like umOrg.id+'%') as ProNum from umOrg where umOrg.bcfl='0'错误 
umOrg
ID Name
1  A公司
101 技术部umStaff
ID bcfl Name
1  1/101 testtest是A公司技术部的

解决方案 »

  1.   

    语法错误,MYSQL里面没有  +  这个东西做连接符的。
      

  2.   

    如一楼所说,MYSQL中字符连接不用 +或者|| ,而是使用 concat 连接函数
    select umOrg.*,(select count(0) from umStaff where bcfl Like Concat(umOrg.id,'%')) as ProNum from umOrg where umOrg.bcfl='0'
      

  3.   

    select umOrg.*,(select count(0) from umStaff where bcfl like concat(umOrg.id,'%')) 
    as ProNum from umOrg where umOrg.bcfl='0'