tsql - How to correct this if exists query?
问题描述
Do you know why this piece of code returns syntax error? A subquery executes properly.
if exists (
select ad_ulica from #adresy_sprawdzenie where DN=1 and RN=1 and
ad_ulica=(select ad_ulica from #adresy_sprawdzenie where DN=1 and
RN=2)
)
解决方案
发现一个问题,并在下面修复它:
if exists (
select ad_ulica from #adresy_sprawdzenie where DN=1 and RN=1 and
ad_ulica in (select ad_ulica from #adresy_sprawdzenie where DN=1 and
RN=2)
)
begin
-- tsql here
end
else
begin
-- tsql here
end
代替...and ad_ulica =(select ad_ulica from #adresy_sprawdzenie where DN=1 and RN=2)
我用 替换了等号in
。
让我知道它是否有效。
推荐阅读
- r - 分层ggplot
- python - 有人可以告诉我一个更有效/更短的方法来编写这个 python random # 程序吗?
- postgresql - Postgres ALL 运算符有什么替代品吗?
- python - 非泛型类型的不同运行时行为
- javascript - 一旦变量在服务器端发生变化而不刷新就更新ejs页面变量
- spring-boot - EhCache springboot如何获取CacheStatistics
- java - RSS 提要 - 数据解析
- matlab - 如何在 MATLAB 上绘制相邻数据点
- macos - 在 MAC OS 上使用带有 .NET 的 SQLITE ODBC
- python - 模块 'fontforge' 没有属性 'open'