我有以下查询,但它不会为 where 子句返回任何结果,即使存在具有这种名称的行所查询的内容。如果我删除 where 子句,则返回 Company 表中具有 OfficeLocation 表的所有记录。我的查询有什么问题?
SELECT c.*
FROM [MyDb].[dbo].[Company] AS c
INNER JOIN [MyDb].[dbo].[CompanyOfficeLocation] AS col ON c.Id = col.CompanyId
INNER JOIN [MyDb].[dbo].[OfficeLocation] AS ol ON ol.Id = col.OfficeLocationId
WHERE ol.Name like '%Actual Name In This Table%';
表结构:
Company
Id
etc ...
CompanyOfficeLocation
CompanyId
OfficeLocationId
OfficeLocation
Id
etc ...