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 編輯過 |
關鍵字查詢
相關文章
正在查詢... |