用一个生气了语句进行模糊查询,like后边的内容是用select classname from KSAQZBCOM_ProductClass where classid='168'查询的结果
但是下边的sql语句有错误,应该怎么写求助select * from KSAQZBCOM_production_company where p_zycp like '%"(select classname from KSAQZBCOM_ProductClass where classid='168')"%'
但是下边的sql语句有错误,应该怎么写求助select * from KSAQZBCOM_production_company where p_zycp like '%"(select classname from KSAQZBCOM_ProductClass where classid='168')"%'
classname="select classname from "&sysfilename&"productClass where ClassID="&CID&"
select * from "&sysfilename&"Production_Company where P_Zycp like '%classname%'
on charindex(B.classname,A.p_zycp)>0
where B.classid='168'
第二句把查的classname值放在第二句的like后边
classname="select classname from "&sysfilename&"productClass where ClassID="&CID&"
select * from "&sysfilename&"Production_Company where P_Zycp like '%classname%'
set @s=''
select @s=@s+QUOTENAME(classname)
from KSAQZBCOM_ProductClass
where classid='168'
--print @s
exec('select * from KSAQZBCOM_production_company where p_zycp like '''+'%'+@s+'%''')