目录
前言
Common Table Expressions(CTE):公共表达式是一个临时的结果集,该结果集是从with子句中指定的查询派生而来的,紧跟在select 或 insert关键字之前。CTE可以在 select,insert, create table as select 等语句中使用。
1.语法
[wtih CommonTableExpression]
select
column1,
column2, ...
from table
[where 条件]
[group by column]
[order by column]
[cluster by column| [distribute by column] [sort by column]
[limit [offset,] rows];
2. 使用场景
-
select语句
with tmp as (
select
oid,
uid,
otime,
date_format(otime, 'yyyy-MM') as
订阅专栏 解锁全文

2800

被折叠的 条评论
为什么被折叠?



