一条插入数据的语句

INSERT INTO BDLLY_2V.MWDMXX (MWDM,MWDMMC,MWFLDM,MWFLMC,MXDMMC,MWZT,MWSM,MWWZ_BH)--,PYM) 

       

    SELECT '01-'||t4.ID||'-'||SUBSTR(t4.mdbh,11,3) AS MWDM,

              SUBSTR(t4.mdbh,11,3)||'' AS MWDMMC,

              t4.ID AS MWFLDM,

              SUBSTR(t4.mdmc,1,INSTR(t4.mdmc,'')) AS MWFLMC,

              TRIM(t4.MX) AS MXDMMC,

              ( CASE trim(t4.zt )

                WHEN '待售' THEN 0

                WHEN '立墓' THEN 1

                WHEN '预定' THEN 2

                WHEN '保留' THEN 4

                END) AS MWZT,

              TRIM(t4.MDMC) AS MWSM,

              TRIM(t4.MDBH) AS MWWZ_BH

              --,TRIM(FTGM.GETHZPYCAP(t4.MDMC)) AS PYM   

              

             FROM 

               (

                 SELECT '01-'||t3.ID||'-'||SUBSTR(t3.mdbh,11,3) AS MWDM,t3.* 

                  FROM 

                   (  

                     SELECT t1.*,t2.* 

                      FROM bdlly.LY_MDXX t1,

                       bdlly.ly_md t2 

                        WHERE SUBSTR(t1.mdbh,1,10) = t2.bh  

                   ) t3

               ) t4;

 

你可能感兴趣的:(数据)