//t1比t2表多的找出1 张华,5 刘德华,处理特殊字符
求助//t1比t2表多的找出1 张华,5 刘德华,处理特殊字符

select 1 as false,id,name from t1 where not exists (select 2 from t2 where t1.id=t2.id and (t1.name=substring(t2.name,1,instr(t2.name,'(')-1 where instr(gm,'(')>0))
select 1 as false,id,name from t1 where not exists (select 2 from t2 where t1.id=t2.id and t1.name=t2.name) //之前对的
------解决方案--------------------
instr这个不是SQL SERVER的函数,换成charindex。
instr(gm,这里没有gm这个字段吧。
select 1 as false,id,name from t1 where not exists (select 2 from t2 where t1.id=t2.id and (t1.name=substring(t2.name,1,instr(t2.name,'(')-1 where instr(gm,'(')>0))
select 1 as false,id,name from t1 where not exists (select 2 from t2 where t1.id=t2.id and t1.name=t2.name) //之前对的
------解决方案--------------------
instr这个不是SQL SERVER的函数,换成charindex。
instr(gm,这里没有gm这个字段吧。