以下语句为什么查不到数据:
select slm,substr(id,1,5) lb,count(*) wjsnum from wscl_wsda_file 
join xtwh_struct_class on dh like '''+substr(id,1,5)%+'''
where length(slh)>=4 and wjnd='2004' group by slm,substr(id,1,5) order by slm;以上语句正确吗?

解决方案 »

  1.   

    select slm,substr(id,1,5) lb,count(*) wjsnum from wscl_wsda_file 
    join xtwh_struct_class on dh like "+substr(id,1,5)%+" where length(slh)>=4 and wjnd='2004' group by slm,substr(id,1,5) order by slm; 
      

  2.   

    like 后面跟正则表达式
    比如 select * from test where test_name like '_e%';
    表示字符‘e’前面一个字符,后面可以是0个或者多个字符