日期:2014-05-17  浏览次数:20728 次

关于子查询
select a1.calldate , a1.src , a1.dst ,a1.billsec 
,  (select accountNumber from poicomcce.customer b1 where  a1.dst like  "%"+b1.Phone+"%"   ) accountNumber 
from asterisk.ast_cdr a1  
where src  in (2602,2615,2636)   limit 200

红字部份我想要做模糊查询,应该怎样写呢?请指点,谢谢
------最佳解决方案--------------------

where charindex(b1.Phone,a1.dst) > 0 

------其他解决方案--------------------
select a1.calldate , a1.src , a1.dst ,a1.billsec 
,  (select accountNumber from poicomcce.customer b1 where  a1.dst like  '%'+b1.Phone+'%'   ) accountNumber 
from asterisk.ast_cdr a1  
where src  in (2602,2615,2636)   limit 200

单引号的吧。你是MYSQL?
------其他解决方案--------------------
limit  mysql
------其他解决方案--------------------
引用:
SQL code12where charindex(b1.Phone,a1.dst) > 0

感谢问题已经解决,我用的是mysql换个方法就行了!