两张表数据模糊查询

判断pg_cust_analysis_all表中的’客户名称‘字段是否包含 ICP.dbo.a 表中的ai字段中的数据

eccrc_rep.dbo.pg_cust_analysis_all.客户名称是公司名

ICP.dbo.a.ai是‘ai’发音的汉字

这个需求是计算公司名中包含“爱”同音字

select count(*) from ICP.dbo.a a,eccrc_rep.dbo.pg_cust_analysis_all b where charindex(a.ai,b.客户名称)<>0 and b.客户状态='0'

select count(b.客户名称) from ICP.dbo.a a,eccrc_rep.dbo.pg_cust_analysis_all b where b.客户名称 like '%'+a.ai+'%'

猜你喜欢

转载自www.cnblogs.com/cheng-cheng/p/10773407.html