1. 创建临时表
with tmp as (select ... from ...) select ... from ...
--创建单个临时表后,重新书写查询语句时,无需逗号隔开。
with tmp1 as (select ... from ...), with tmp2 as (select ... from ...)
--创建多个临时表时,需逗号分隔。
2. 选择分支
case when ... then '...' when ... then '...' else ... end as ...
--多分支无需逗号分隔,注意单引号位置。
3. 窗口函数
... over(partition by ... order by ...)
--注意括号内的语法顺序。
... over(order by rows between unbounded preceding and current row) ... over(rows between unbounded preceding and unbounded following)
--注意 order by、rows between 缺省时,rows between 的默认值。
标签:...,易错,rows,--,unbounded,语法,between,select From: https://www.cnblogs.com/peitongshi/p/16942912.html