1
Azure SQL数据仓库是否支持具有子查询结构的多列IN/NOT IN?Azure SQL数据仓库中的多列IN/NOT IN子查询
运行时类的查询:
select
*
from
schema_name.calendar
where
gregorian_date > '1998-01-01'
and gregorian_date < '1999-01-01'
and (yr_wk, day_of_wk) not in (select yr_wk, day_of_wk from schema_name.calendar where week = 25)
;
select
*
from
schema_name.calendar
where
gregorian_date > '1998-01-01'
and gregorian_date < '1999-01-01'
and (yr_wk, day_of_wk) in (select yr_wk, day_of_wk from schema_name.calendar where week = 25)
;
收到错误。
SQL Error [103010] [S0001]: Parse error at line: 7, column: 14: Incorrect syntax near ','.
com.microsoft.sqlserver.jdbc.SQLServerException: Parse error at line: 7, column: 14: Incorrect syntax near ','.
解决方法是使用内连接还是外连接将查询重写为派生表?
在单柱/ NOT IN子做的工作:
select
*
from
schema_name.calendar
where
gregorian_date > '1998-01-01'
and gregorian_date < '1999-01-01'
and (yr_wk) not in (select yr_wk from schema_name.calendar where week = 25)
;
select
*
from
schema_name.calendar
where
gregorian_date > '1998-01-01'
and gregorian_date < '1999-01-01'
and (yr_wk) in (select yr_wk from schema_name.calendar where week = 25)
;