阅读背景:

如何使用sub select中的值

来源:互联网 

I have one select:

我有一个选择:

select
b.[FiscalPeriod],
b.[Column2],b.[Current_Value],
(
    select TOP 1 [Column3] from [table1] b2 
    where month(b.ReportingPeriod) = month(DATEADD(month,1,b2.ReportingPeriod))
      AND YEAR(b.ReportingPeriod) = YEAR(DATEADD(month,1,b2.ReportingPeriod))
      AND b.id = b2.id
) as PREV_VALUE 
FROM [table1] b
select
b.[Fiscal



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: