相當於建立一個臨時的表

with tt as (select *  from t)
select * from tt;

查詢完就清除了,不佔空間

可以用於子查詢

如:

update t set a=(with tt as (select * from t)
select * from tt where tt.rowid=t.rowid );

*** with table as 的rowid與 他參考的表的rowid 是一樣的,因此可以透過rowid來關聯(也可以用原來的欄位)

 

 

文章標籤
全站熱搜
創作者介紹
創作者 to52016 的頭像
to52016

Eason [資料科學//Python學習/資料庫] & [拍片&剪片]

to52016 發表在 痞客邦 留言(0) 人氣(2,816)