在 Microstrategy Netezza 语法中应用去年的简单公式

ApplySimple Formula for last year in Microstrategy Netezza syntax

我需要一些帮助来将以下 applysimple 语句转换为它的 netezza 等效语句。

ApplySimple("(
   select top 1 tradyrcode
   from tradingyear
   where tradyrcode < (
      select max(tradyrcode)
      from yrdays yd, control c
      where c.systemdate = yd.datecode
   )
   order by 1 desc
)",0)

我想我需要将 top 1 更改为 limit 1 才能在 netezza 中使用。

如有任何帮助,我们将不胜感激!

其中“top nn”在语句的开头,“limit nn”必须在最后,在可能的“order by”之后:

select tradyrcode
from trading-year
where tradyrcode < (
  select max(tradyrcode)
  from yrdays yd, control c
  where c.systemdate = yd.datecode
)
order by 1 desc
limit 1