CTE(With As)

WITH tabdate(dt) AS (
    SELECT 1 
    FROM
        dual
    UNION ALL
    SELECT  dt+1 
    FROM
        tabdate
    WHERE
        dt < 10 
    )
    SELECT  *
    FROM TabDate   ;  

一、With Table(字段) as (。。。)和后面的Select *  from  Table是一个整体,不允许在select前增加分号; 

二、更新:  Update table Set A with tablleB as () select *  from  tablellB    新增:Insert Into A(a,b,c) with TT(aa,bb,cc) as (...)select aa,bb,cc from TT;

posted @ 2019-03-07 19:42  KunSun  阅读(218)  评论(0编辑  收藏  举报