更新时间:2023-08-25 11:13:34
如果 LegalIssue
包含一串用逗号分隔的数字,则您真的想要一个关联表。缺少这一点,这是进行联接的一种方便(但效率不高)的方法:
If LegalIssue
contains a string of comma-delimited numbers, then you really want an association table. Lacking that, here is a convenient (but not efficient) way to do the join:
SELECT F.[FDTitle], E.PrimaryOpID as [FD Primary OP ID], F.County as [FD County],
F.Status as [FD Status], F.IssueDate as [FD Date]
FROM [dbo].[tbl_FinalDetMain] F LEFT OUTER JOIN
[dbo].[tbl_lk_Exemptions_FD] E
ON ','+F.LegalIssue+',' like '%,'cast(E.ID as varchar(255))+',%'
WHERE F.[FDNbr] = '2013-0041';
这会在列表前加上逗号,以免产生冲突,例如在 1,100中找到 10 ,1000。
This prepends and postpends the list with commas to avoid conflicts, such as finding "10" in "1,100,1000".