Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/79.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql 将周合计解组为日期_Sql_Amazon Redshift - Fatal编程技术网

Sql 将周合计解组为日期

Sql 将周合计解组为日期,sql,amazon-redshift,Sql,Amazon Redshift,很难找到解决办法 我有每周总计的数据,我想将其分解为日期级别,其中总计除以一周中的天数 起跑台 周 数量 2020-10-18 1000 2020-10-25 2000 红移使动态生成表变得困难。但7行也没那么糟糕: select week + n * interval '1 day', amount / 7.0 from starting s cross join (select 0 as n union all select 1 as n union all

很难找到解决办法

我有每周总计的数据,我想将其分解为日期级别,其中总计除以一周中的天数

起跑台

周 数量 2020-10-18 1000 2020-10-25 2000
红移使动态生成表变得困难。但7行也没那么糟糕:

select week + n * interval '1 day', amount / 7.0
from starting s cross join
     (select 0 as n union all
      select 1 as n union all
      select 2 as n union all
      select 3 as n union all
      select 4 as n union all
      select 5 as n union all
      select 6 as n 
     ) n

我假设您正在使用红移,并且错误地解释为它类似于Postgres(或者说,与其他随机数据库相比更类似于Postgres)。我去掉了Postgres标签。