首页
学习
活动
专区
圈层
工具
发布
    • 综合排序
    • 最热优先
    • 最新优先
    时间不限
  • 来自专栏james大数据架构

    你真的会玩SQL吗?玩爆你的数据报表之存储过程编写(下)

    (CASE YearMonth WHEN @Year+'-01' THEN val ELSE 0 END) AS '2011-01', MAX(CASE YearMonth WHEN @Year YearMonth WHEN @Year+'-05' THEN val ELSE 0 END) AS '2011-05', MAX(CASE YearMonth WHEN @Year+'-06 '2011-07', MAX(CASE YearMonth WHEN @Year+'-08' THEN val ELSE 0 END) AS '2011-08', MAX(CASE YearMonth MAX(CASE YearMonth WHEN @Year+'-12' THEN val ELSE 0 END) AS '2011-12', MAX(CASE YearMonth WHEN =b.ProductGUID AND #TempSaleDtl.YearMonth=b.YearMonth LEFT JOIN #ProductSaleArea c ON c.ProductGUID=#

    1.5K60发布于 2018-01-22
  • 来自专栏开源部署

    用简单程序协助MySQL实现窗口函数

    b) select yearmonth,province,sales, sum(sales) over (partition by yearmonth) `sum`, avg(sales) over ( by yearmonth) `min`, count(*) over (partition by yearmonth) `count` from detail where yearmonth in ( ) over(partition by yearmonth) `std` from detail where yearmonth in (201601, 201602); (1)A3 按月份分组 (2 , sales, ntile(3) over(partition by yearmonth) `ntile` from detail where yearmonth=201601 or( yearmonth yearmonth=201601 or (yearmonth=201602 and sales>50000); (1)A5 中,seq(yearmonth) 尽可能不要在 if 函数中使用,因为 seq

    1.8K30编辑于 2022-08-17
  • 来自专栏软件研发

    解决:java.time.format.DateTimeParseException: Text '201906' could not be parsed: U

    使用其他的日期和时间类如果我们只关注年份和月份,并不需要具体的日期和时间信息,那么我们可以考虑使用其他的日期和时间类型,例如​​YearMonth​​。​​ YearMonth​​类表示一个年份和月份的组合。我们可以使用​​YearMonth.parse​​方法将字符串解析为​​YearMonth​​对象,而无需关心具体的日期和时间。 类 YearMonth yearMonth = YearMonth.parse(str, formatter); System.out.println("解决方案 = null) { YearMonth reportDate = YearMonth.parse(line, formatter); System.out.println 对于每一行日期数据,我们使用​​YearMonth.parse​​方法将其解析为​​YearMonth​​对象,然后将其打印出来或进行其他的业务逻辑。

    4K20编辑于 2023-11-03
  • 来自专栏james大数据架构

    你真的会玩SQL吗?玩爆你的数据报表之存储过程编写(上)

    =b.ProductGUID AND #TempSaleDtl.YearMonth=b.YearMonth LEFT JOIN #ProductSaleArea c ON c.ProductGUID=# TempSaleDtl.ProductGUID 注意这里用到了滑动累计聚合 m.YearMonth<=n.YearMonth(不懂滑动累计聚合请看之前的系列) ,利用子查询统计出 每个产品到当月为止的累计销售面积 ,YearMonth UNION ALL SELECT ProductGUID,'销售均价' AS type,'03' AS typecode,YearMonth,MAX(SalePrice ,YearMonth UNION ALL SELECT ProductGUID,'累计销售面积' AS type, '05' AS typecode,YearMonth,SUM(ljSaleArea ' AS type, '06' AS typecode,YearMonth,SUM(blSaleArea) FROM #TempSaleDtl GROUP BY ProductGUID,YearMonth

    2.4K80发布于 2018-01-22
  • 来自专栏Java技术

    CoderOilStation updating coding inputs get day of programmer by using Russia

    Octor31 Norve30 Decem31         int daySum=0;         for (int i = 0; i < 12; i++) {             int yearMonth =i+1;             if(yearMonth==GregorianCalendarMonthEnum.JAN.getMonthVal()){                 daySum i1);                     break;                 }                 continue;             }else if(yearMonth i1);                     break;                 }                 continue;             }else if(yearMonth =i+1;             if(yearMonth==GregorianCalendarMonthEnum.JAN.getMonthVal()){                 daySum

    14000编辑于 2025-06-15
  • 来自专栏数据库相关

    sqlserver查看备份历史记录

    AS DatabaseName, MAX(YEAR(backup_start_date) * 100 + MONTH(backup_start_date)) AS YearMonth getdate() ) AND getdate() GROUP BY [database_name],DATEPART(mm,[backup_start_date]) Order by YearMonth FROM HISTORY AS H1 WHERE H1.DBName = H.DBName AND H1.YearMonth < H.YearMonth ORDER BY H1.YearMonth DESC) AS DBGrowthMB FROM HISTORY AS H ORDER BY H.DBName ,H.YearMonth;

    1.4K10编辑于 2024-08-01
  • 来自专栏IT云清

    SQL---计算两个日期之间的时间差

    1 2.然后,在java代码中,对这个月数做个简单的处理即可,如下: long monthCount = (long)map.get("monthDiff"); String yearMonth = ""; if(monthCount == 12){ yearMonth = "1年"; }else if(monthCount < 12){ yearMonth = monthCount + "个月"; }else if(monthCount > 12){ yearMonth = monthCount/12L+"年"+monthCount%12L+"个月"; } map.put("yearMonth",yearMonth 比如,monthCount = 20L时,这个yearMonth =“1年8个月”

    9.9K20发布于 2019-01-22
  • 来自专栏做数据的二号姬

    SQL踩坑经验 | 用SQL实现帕累托累计和滚动平均值

    ,         b.target,         date_parse(b.yearmonth, '%Y%m') as yearmonth_date,         sum(b.value) over 需求是写过去6个月的平均达成率不含当前月,也就是说,需要sum求和的范围其实是: select         m.bu,         m.yearmonth,         m.yearmonth_date ,         sum(case when m2.yearmonth_date between date_add('month', -7, m.yearmonth_date) and date_add m2.yearmonth_date between date_add('month', -7, m.yearmonth_date) and date_add('month', -1, m.yearmonth_date  end)              / nullif(sum(case when m2.yearmonth_date between date_add('month', -13, m.yearmonth_date

    40810编辑于 2025-07-04
  • 来自专栏磐创AI技术团队的专栏

    加载大型CSV文件到Pandas DataFrame的技巧和诀窍

    : df = pd.read_csv("custom_1988_2020.csv", header=None, names=['YearMonth , 'Country', 'Q1', 'Q2_Quantity', 'Value']) display(df) 现在DataFrame的列名如下:“YearMonth df = pd.read_csv("custom_1988_2020.csv", header=None, names=['YearMonth : df = pd.read_csv("custom_1988_2020.csv", header=None, names=['YearMonth : df = pd.read_csv("custom_1988_2020.csv", header=None, names=['YearMonth

    2.7K10编辑于 2024-04-03
  • 来自专栏PowerBI入门100例

    1.1 PowerBI数据准备-复制粘贴PowerQuery代码,生成多功能日期表

    Order" = Table.AddColumn(#"Added YearQuarter Offset", "YearMonth_Order", each [Month]+12*([Year]-List.Min (#"Added Year" [Year])) , Int64.Type), #"Added YearMonth Offset" = Table.AddColumn(#"Added YearMonth Order", "YearMonth_Offset", each [YearMonth_Order] - (Date.Month(today)+12*(Date.Year(today)-List.Min " = Table.AddColumn(#"Added YearQuarter_CurrentQuarterMark", "YearMonth_CMMark", each if [YearMonth_Offset (#"Added YearMonth_CurrentMonthMark", "YearWeek_CWMark", each if [YearWeek_Offset]=0 then "当前年周" else

    66100编辑于 2025-02-20
  • 来自专栏Hadoop数据仓库

    使用 pt-online-schema-change 将 MySQL 表改为分区表

    int not null default (year(createtime)*100+month(createtime)), drop primary key, add primary key(id,yearmonth ) partition by range(yearmonth) (partition p202305 values less than(202306), partition p202306 values ` int(11) NOT NULL, PRIMARY KEY (`id`,`yearmonth`) ) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET 50100 PARTITION BY RANGE (`yearmonth`) (PARTITION p202305 VALUES LESS THAN (202306) ENGINE = InnoDB, (year(b)*100+month(b)); ERROR 1048 (23000): Column 'yearmonth' cannot be null

    83580编辑于 2023-11-15
  • 来自专栏翎野君

    java8将日期格式yyyyMM转换为LocalDate

    解决方法一 如果你只是想分析了一年一个月,你可以使用YearMonth对象,然后再根据YearMonth对象获取对应月的其中一天: DateTimeFormatter fmt = DateTimeFormatter.ofPattern ("yyyyMM"); YearMonth ym = YearMonth.parse("202211", fmt); LocalDate dt = ym.atEndOfMonth(); 解决方法二 但是

    2.4K20编辑于 2023-05-12
  • 来自专栏python与大数据分析

    Oracle分析函数七——函数案例

    varchar2(6), salary number ) SELECT employeeno, yearmonth, salary, MIN(salary) KEEP LAG(salary,1,0) OVER (PARTITION BY employeeno ORDER BY yearmonth) AS prev_sal, --环比分析,与上个月份进行比较 LAG(salary,12,0) OVER (PARTITION BY employeeno ORDER BY yearmonth) AS prev_12_sal --同比分析,与上个年度相同月份进行比较 FROM salaryByMonth ORDER BY employeeno,yearmonth --SQL常用的算法 SELECT * FROM salaryByMonth a ) OVER (PARTITION BY employeeno ORDER BY salary DESC) AS high_yearmonth FROM salaryByMonth

    59920编辑于 2022-03-11
  • 来自专栏PowerBI入门100例

    1.20 PowerBI数据准备-日期表增加节假日、工作日分析相关列

    List.Sum(Table.SelectRows(#"Changed Type",(x)=>x[YearMonth]=[YearMonth] and x[Date]<=[Date])[Is_Workday if List.Min(Table.SelectRows(#"Changed Type1",(x)=>x[Date]=Parameter_Today)[WorkdayOfMonth])>=6 and [YearMonth if List.Min(Table.SelectRows(#"Changed Type1",(x)=>x[Date]=Parameter_Today)[WorkdayOfMonth])<=5 and [YearMonth ]= Number.FromText(Date.ToText(Date.AddMonths(Parameter_Today,-1),"yyyyMM"))then "当月" else [YearMonth

    83400编辑于 2025-02-23
  • 来自专栏PowerBI入门100例

    1.21 PowerBI数据准备-日期表按事实表最新日期增加当前年/月等相关列

    Year_CY_Mark_按最新销售:if [Year]= Date.Year(MaxDateofFact_Sales)then "当年"else [Year]YearMonth_CM_Mark_按最新销售 :if [YearMonth]= Date.Year(MaxDateofFact_Sales)*100+Date.Month(MaxDateofFact_Sales)then "当月"else [YearMonth (MaxDateofFact_Sales)MonthOrder(辅助列,用于生成YearMont_Offset):[Month]+12*([Year]-List.Min(Source [Year]))YearMonth_Offset Date.Month(MaxDateofFact_Sales)+12*(Date.Year(MaxDateofFact_Sales)-List.Min(Source [Year])))生成的标记列,如下:把YearMonth_Offset

    83110编辑于 2025-02-23
  • 来自专栏Nicky's blog

    个人博客项目之文章归档实现

    yearmonth=${ac[0]}-${ac[1]}"> ${ac[0]}年${ac[1]}月(${ac[2] })

  • </c:forEach> </c:when> <c: ),'%Y%m') " + "order by articleTime desc") public List
    findArticleByMonth(@Param("yearmonth ")Date yearmonth); Service类里调用: /** * 按月份获取文章信息 * @param month * @return */ @Transactional return articleRepository.findArticleByMonth(month); } 在JSP页面写入,getArchiveArticles.do就是要访问的url,传入yearmonth yearmonth=${ac[0]}-${ac[1]}"> ${ac[0]}年${ac[1]}月(${ac[2] }) </c:forEach> </c:when> <c:

48230编辑于 2022-05-07
  • 来自专栏Nicky's blog

    基于Spring Data JPA框架的文章归档实现

    yearmonth=${ac[0]}-${ac[1]}"> ${ac[0]}年${ac[1]}月(${ac[2] })

  • </c:forEach> ') " + "order by articleTime desc") public List
    findArticleByMonth(@Param("yearmonth ")Date yearmonth); Service类里调用: /** * 按月份获取文章信息 * @param month * @return */ return articleRepository.findArticleByMonth(month); } 在JSP页面写入,getArchiveArticles.do就是要访问的url,传入yearmonth yearmonth=${ac[0]}-${ac[1]}"> ${ac[0]}年${ac[1]}月(${ac[2] }) </c:forEach>

    71820发布于 2019-01-17
  • 来自专栏PowerBI入门100例

    2.20 PowerBI数据建模-移动平均

    vm_MaxSalesDate = MAXX(ALL('Fact_Sales'[日期]),[日期])VAR _SelectedTimePoint = SELECTEDVALUE('Dim_Date'[YearMonth ])VAR _vm_MinTimePoint = CALCULATE(VALUES('Dim_Date'[YearMonth]), FILTER(ALL('Dim_Date'), 'Dim_Date'[ vm_MinSalesDate)+_vm_N-1, DAY(_vm_MinSalesDate))))VAR _vm_MaxTimePoint = CALCULATE(VALUES('Dim_Date'[YearMonth (ALL('Dim_Date'), 'Dim_Date'[Date] = _vm_MaxSalesDate))VAR _vm_R_N_Total =IF(HASONEVALUE('Dim_Date'[YearMonth DATESINPERIOD的参数MONTH替换为DAY或YEAR,把最小时间节点中的月份移动MONTH(_vm_MinSalesDate)+_vm_N-1变为日或年的移动,以及用到年月字段'Dim_Date'[YearMonth

    52600编辑于 2025-02-24
  • 来自专栏PowerBI入门100例

    2.22 PowerBI数据建模-3种平均值

    Average_AverageX = AVERAGEX(VALUES('Date'[YearMonth]), [Sales])2 取所选的样本个数,不管这些样本有没有值。 Average_Divide = DIVIDE([Sales], DISTINCTCOUNT('Date'[YearMonth]))3 取开始有值的第一个月及它以后的所选样本个数。 VAR _vm_StartDate = FIRSTDATE('Fact_Sales'[日期])VAR _vm_NumberOfMonth = CALCULATE(DISTINCTCOUNT('Date'[YearMonth

    44410编辑于 2025-02-24
  • 来自专栏PowerBI

    BI技巧丨滚动柱形图

    ." & MONTE, "YearMonth", YEAR * 12 + MONTE ) ) 建立模型关系如下: [1240] 添加如下基础度量值 , MONTE, "日", DAY, "年度月份", YEAR & "." & MONTE, "YearMonth 编写如下度量值: B.滚动度量值 = VAR SelectedYearMonth = SELECTEDVALUE ( 'Dim_Data_II'[YearMonth] ) VAR SelectedYearMonthPeriod = SelectedYearMonth - [移动区间周期 值] VAR CurrentYearMonth = SELECTEDVALUE ( Dim_Data[YearMonth] ) RETURN

    1.1K20编辑于 2022-05-14
  • 第 2 页第 3 页第 4 页第 5 页第 6 页第 7 页
    点击加载更多
    领券