Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/70.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 - Fatal编程技术网

Sql 变量的第一行(红移)

Sql 变量的第一行(红移),sql,Sql,感兴趣的行: -日期 -城市 -交付 如何返回每个城市有史以来第一次交付的表格?我认为它redshift支持row\u number: select * from ( select date, city, delivery, row_number() over (partition by city order by date desc) rn from yourtable ) t where rn = 1

感兴趣的行: -日期 -城市 -交付


如何返回每个城市有史以来第一次交付的表格?

我认为它
redshift
支持
row\u number

select *
from (
    select date, city, delivery, 
           row_number() over (partition by city order by date desc) rn
    from yourtable
) t
where rn = 1