我正在尝试使用 SQL Server 仅选择一个帐户,但出现以下错误:
错误:文本数据类型无法选择为 DISTINCT,因为它不可比较。错误代码:421
带有以下声明:
select DISTINCT ad.*,
acc.companyname,
acc.accountnumber
from address ad
join AddressLink al on al.AddressID = ad.id
join account acc on acc.ID = al.ParentID
where acc.accountnumber like '11227'
我做错了什么?
编辑:
新查询:
select address.ID,
address.StreetAddress1,
address.StreetAddress2,
address.City,
Address.State,
Address.PostalCode,
Address.ClassTypeID,
account.companyname,
account.accountnumber,
addresslink.ID as addressLinkID,
addresslink.addresstypeid
from address
join AddressLink on address.id = addresslink.AddressID
join account on addresslink.ParentID = account.ID
where account.CompanyName like 'company name'
我必须模糊的所有公司名称都是相同的。