zoukankan      html  css  js  c++  java
  • MAKEDATE & EXTRACT

    MAKEDATE &  EXTRACT

    interval QUARTER


    select
    date_format(LAST_DAY(MAKEDATE(EXTRACT(YEAR FROM concat('202003','01')),1) + interval QUARTER(concat('202003','01'))*3-3 month),'%m月'),'01日'
    ,QUARTER(concat('202006','01'))

    select distinct '' as '表头1'
    ,concat(substr('202003',1,4),'年',concat(date_format(LAST_DAY(MAKEDATE(EXTRACT(YEAR FROM concat('202003','01')),1) + interval QUARTER(concat('202003','01'))*3-3 month),'%m月'),'01日'),'-',
    date_format(a2.version_end_date,'%m月%d日'),'预估') as '表头2'
    ,concat(substr('202003',1,4),'年',concat(date_format(LAST_DAY(MAKEDATE(EXTRACT(YEAR FROM concat('202003','01')),1) + interval QUARTER(concat('202003','01'))*3-3 month),'%m月'),'01日'),'-',
    date_format(a2.version_end_date,'%m月%d日'),'预估完成率') as '表头3'
    ,concat(substr('202003',1,4),'年',concat(date_format(LAST_DAY(MAKEDATE(EXTRACT(YEAR FROM concat('202003','01')),1) + interval QUARTER(concat('202003','01'))*3-3 month),'%m月'),'01日'),'-',
    date_format(a2.version_end_date,'%m月%d日'),'预估') as '表头4'
    ,concat(substr('202003',1,4),'年',concat(date_format(LAST_DAY(MAKEDATE(EXTRACT(YEAR FROM concat('202003','01')),1) + interval QUARTER(concat('202003','01'))*3-3 month),'%m月'),'01日'),'-',
    date_format(a2.version_end_date,'%m月%d日'),'预算') as '表头5'
    ,concat(substr('202003',1,4),'年',concat(date_format(LAST_DAY(MAKEDATE(EXTRACT(YEAR FROM concat('202003','01')),1) + interval QUARTER(concat('202003','01'))*3-3 month),'%m月'),'01日'),'-',
    date_format(a2.version_end_date,'%m月%d日'),' YOY Growth%') as '表头6'
    ,concat(substr('202003',1,4),'年',concat(date_format(LAST_DAY(MAKEDATE(EXTRACT(YEAR FROM concat('202003','01')),1) + interval QUARTER(concat('202003','01'))*3-3 month),'%m月'),'01日'),'-',
    date_format(a2.version_end_date,'%m月%d日'),'实际数') as '表头7'
    from db_dw.t03_shop_gmvrevslp_version a1
    inner join db_dw.t00_d_version_info a2
    on a1.version_date = a2.version_date
    where a1.version_date = '20200315' /*传入参数*/
    and a1.index_yearmonth = '202003' /*传入参数*/

  • 相关阅读:
    Velocity的使用小记
    fastJson的SerializeFilter使用
    快捷的时间转化
    How to execute a Stored Procedure with Entity Framework Code First
    自定义 ASP.NET Identity Data Model with EF
    Asp.Net Core get client IP
    HTTP 请求头中的 X-Forwarded-For
    HttpRequest,WebRequest,HttpWebRequest,WebClient,HttpClient 之间的区别
    【逻辑】500桶酒,找毒酒
    Asp.Net Core 输出 Word
  • 原文地址:https://www.cnblogs.com/linbo3168/p/12498555.html
Copyright © 2011-2022 走看看