首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

关于子查询,该如何处理

2012-12-15 
关于子查询select a1.calldate , a1.src , a1.dst ,a1.billsec ,(select accountNumber from poicomcce.cu

关于子查询
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换个方法就行了!

热点排行