SQL使用with构建临时表
当前位置:点晴教程→知识管理交流
→『 技术文档交流 』
with x as ( select 1 as id ,'Adam' as name from dual union all select 2 as id ,'John' as name from dual ) select * from x 这样就构造了一个由两行组成的临时表。 如果需要构造临时表来表示表间关系: with a as (select 1 as id from dual union all select 2 as id from dual) , b as (select 1 as id,'Adam' as name from dual union all select 3 as id,'Tom' as name from dual) select a.id,b.name from a left join b on a.id=b.id 使用逗号来表示两表并列,就可以构造两个临时表了。 该文章在 2024/3/20 14:57:45 编辑过 |
关键字查询
相关文章
正在查询... |