sql-备忘-指更新为null的记录

SELECT
  serial_no,
  MAX( setup_date ) setup_date,
  MAX( liquidate_date ) liquidate_date,
  MAX( expire_date ) expire_date 
FROM
  (
  SELECT
    t1.serial_no,
    IFNULL( t1.setup_date, 0 ) setup_date,
    IFNULL( t1.clear_date, 0 ) liquidate_date,
    IFNULL( t1.expire_date, 0 ) expire_date 
  FROM
    sam_saleproject_copy1 t1 UNION ALL
  SELECT
    t2.serial_no,
    1 setup_date,
    1 liquidate_date,
    1 expire_date 
  FROM
    sam_saleproject_copy1 t2 
  ) t3 
GROUP BY
  serial_no
上一篇:DBSCAN算法


下一篇:Python学习2——DBSCAN聚类算法