oracle with as 用法
2017-12-15 11:31
579 查看
With查询语句已with开头,相当于在查询之前先构建一个临时表,被指定的查询结果存与临时表中,之后便可多次使用它做进一步的分析和处理。
语法:
例子:
多个with as 用法 每个临时存量直接用 "," 隔开
如果with as 有嵌套的情况, 多个with as,后面的as内部可以直接调用先声明的临时对象
语法:
with _tempTable as (select * from table ) select * from _tempTable
例子:
with _tempStudent as( select * from t_student t where class = '初二3班' ) select sex,count(1) nums from _tempStudent where sex = '男' and height > '170' union all select sex,count(1) nums from _tempStudent where sex = '女' and height > '160'
多个with as 用法 每个临时存量直接用 "," 隔开
with t1 as ( select * from student where name in('张三','李四') ),t2 as ( select * from student where name in('王五') ) select * from t1 union select * from t2
如果with as 有嵌套的情况, 多个with as,后面的as内部可以直接调用先声明的临时对象
with t1 as ( select * from student where name in('张三','李四') ),t2 as ( select * from t1 where name in('王五') ) select * from t2
相关文章推荐
- Oracle WITH AS 用法
- oracle with as 用法
- ORACLE WITH AS 的用法
- 关于oracle with table as 创建临时表的用法示例以及使用with as 的优点
- oracle关键字with..as和wm_concat的用法说明
- ORACLE WITH AS 用法
- Oracle With As 用法
- with..as oracle的用法
- with..as oracle的用法
- (转)ORACLE WITH AS 用法
- ORACLE WITH AS 用法
- oracle with as 的用法
- oracle with as 用法
- ORACLE WITH AS 用法
- ORACLE WITH AS 用法
- oracle with table as 创建临时表的用法示例
- ORACLE WITH AS 用法
- 关于oracle with table as的用法
- 关于oracle中 with xx as 的用法
- ORACLE WITH AS 用法