带有SqlDependency的IN运算符不起作用
作者:互联网
sqldependency是否与IN运算符一起使用?
我的命令是:
SELECT n.PublishedAt
FROM dbo.Navigations n
WHERE NavigationGroupId IN (SELECT ng.Id FROM dbo.NavigationGroups ng
WHERE ng.SiteId = 1
AND ng.IsActive = 1
AND ng.[Type]= 'Secondary')
AND n.IsActive = 1
我看了一下MSDN Dodumentation,但没有提到IN运算符.
提前致谢.
解决方法:
从文档中:
“The statement must not contain subqueries, outer joins, or self-joins.”
IN通常映射到半联接. Damien_The_Unbeliever指出:
IN() is defined as either a subquery or a sequence of expressions – the one in the OPs question s a subquery.
因此,可能不支持它.
您可以将IN表示为内部联接吗?如果IN查询为每个外部行最多生成一行,则可以保留语义.如果还有更多,则行将重复.不过,对于通知而言,这并不重要.它应该在完全相同的情况下射击.
标签:outputcache,sqldependency,caching,sql,c 来源: https://codeday.me/bug/20191120/2041561.html