sql中with?
使用with子句可以让子查询重用相同的with查询块,通过select调用(with子句只能被select查询块引用),一般在with查询用到多次情况下。在引用的select语句之前定义,同级只能定义with关键字只能使用一次,多个用逗号分割。with子句的返回结果存到用户的临时表空间中,只做一次查询,反复使用,提高效率。
例1
with test_with as(select * from A) select * from B where B.id in(select id from test_with)
As 多用于字段 或表的别名 定义
例select 字段 as zd from 表 as a