我正在尝试select * where column1 = % column2 %
。
这是我的查询
select ticket_cp, id_con, raison_sociale, date, Type, RSP
from en_cours,
Base_Client
where Base_Client.Client like '%'+raison_sociale+ '%'
错误:
数据类型varchar和text在add运算符中不兼容。
您可以将cast
从text
转换为varchar(max)
:
select ticket_cp, id_con, raison_sociale, date, Type, RSP
from en_cours e
inner join base_Client b
on b.Client like '%'+ cast(e.raison_sociale as varchar(max)) + '%'
或者,如果b.Client
也是text
:
on cast(b.Client as varchar(max))
like '%'+ cast(e.raison_sociale as varchar(max)) + '%'