【发布时间】:2014-10-04 14:53:16
【问题描述】:
我正在尝试离开连接 products.table 和manufacturer.table 以将制造商实施到产品表中
唯一的问题是没有 id 链接表,所以我正在尝试这样的事情。
SELECT [kArtikel]
,[cArtNr]
,a.[cName]
,a.[cBeschreibung]
,H.cName
,[cKurzBeschreibung]
,[cHersteller]
,[cHAN]
FROM [db].[dbo].[tartikel] a
left join [db].[dbo].[tHersteller] h on a.cName Like '%H.Cname%'
where cHersteller is null
但是通过这个查询,我只收到 H.cName = Null
2 分钟后执行相同数量的产品,cHersteller = Null
在搜索时,我只找到 join 位于带有 where 子句的某个 id 的示例。但这在这里是不可能的。
【问题讨论】:
-
你用的是什么关系型数据库?
-
MS SQL SERVER 2014 Express
-
你为什么只麻烦将
a和h别名应用于某些列?难道是猜谜游戏,其他列是从哪里来的? -
因为 cName 和 cBeschreibung 存在于表 H 中,其他的没有,所以没有必要
标签: sql sql-server string left-join sql-like