MySql插入查询的数据(命名Sql常用)

1.导入渠道对账索引
insert
into
  rec_sourceidx
  (
          trandt,transq,chnlcd,chnldt,chnlsq,chnlst,tranam,matched
  ) select
    (#trandtidx#,#transqidx#,#chnlcdidx#,#chnldtidx#,#chnlsqidx#,#chnlstidx#,#tranamidx#,'Y') 
  from
    #tablename#
  where
    #trandtidx#>=date_sub(#trandt#,interval #amplitude# day) and #trandtidx#<=date_add(#trandt#,interval #amplitude# day)
    and

              #chnlcdidx#=#chnlcd#;

原文地址:https://www.cnblogs.com/morganlin/p/12123892.html