如果日期晚了,该如何对日期进行排序并算作一行日期?

时间:2019-07-10 03:13:00

标签: netezza

  • EQMT_ID + CAUTION_ID + CAUTION_DT + CAUTION_DSC + ROW_NUM + + ------------------------------------------------- ------------------------------------------------ + < / li>
  • 014E2174-B7B3-494E + C7F9DE7D-EA67 + 2019-05-04 00:00:00 +空气滤清器堵塞+ 1 +
  • 014E2174-B7B3-494E + C7F9DE7D-EA67 + 2019-05-13 00:00:00 +空气滤清器堵塞+ 2 +
  • 014E2174-B7B3-494E + C7F9DE7D-EA67 + 2019-05-15 00:00:00 +空气滤清器堵塞+ 3 +
  • 014E2174-B7B3-494E + C7F9DE7D-EA67 + 2019-05-16 00:00:00 +空气滤清器堵塞+ 4 +
  • 014E2174-B7B3-494E + C7F9DE7D-EA67 + 2019-05-20 00:00:00 +空气滤清器堵塞+ 5 +
  • 014E2174-B7B3-494E + C7F9DE7D-EA67 + 2019-05-21 00:00:00 +空气滤清器堵塞+ 6 +
  • 014E2174-B7B3-494E + C7F9DE7D-EA67 + 2019-05-22 00:00:00 +空气滤清器堵塞+ 7 +
  • 014E2174-B7B3-494E + C7F9DE7D-EA67 + 2019-05-23 00:00:00 +空气滤清器堵塞+ 8 +
  • 014E2174-B7B3-494E + C7F9DE7D-EA67 + 2019-05-25 00:00:00 +空气滤清器堵塞+ 9 + + ------------------------------------------------- ------------------------------------------------ + < / li>

如果序列中有较晚的日期,如何插入日期? 示例:现在于2019-07-10,并更新数据warning_dt 2019-05-24。以便行row_num在2019-05-20到2019-05-25分别基于warning_dt变为1-5?

在Netezza中运行

选择       EQMT_ID     ,CAUTION_ID     ,CAUTION_DT     ,CAUTION_DSC     ,ROW_NUMBER()     过度(         PARTITION BY EQMT_ID,CAUTION_ID,CAUTION_DSC         按EQMT_ID,CAUTION_DT ASC排序)作为行号 来自SOR.CC_EM_EQUIPMENT_CAUTIONS,其中EQMT_ID ='014E2174-B7B3-494E-ECF6-08D6C956A93C'

0 个答案:

没有答案