1. 程式人生 > 其它 >027.hive-hive生成一段連續日期,mysql5.7生成一段連續日期,pgsql生成一段連續日期

027.hive-hive生成一段連續日期,mysql5.7生成一段連續日期,pgsql生成一段連續日期

hive-hive生成一段連續日期

 select  
    pos
    ,date_add(start_date,pos) as stat_date
  from
    (select   '${entryDate}'  as start_date, '${abortDate}'  as end_date) temp
     lateral view
     posexplode(split(space(datediff(end_date, start_date)),'')) t as pos, val

 

mysql5.7生成一段連續日期

SELECT a.Date
FROM
( SELECT CURDATE() - INTERVAL (a.a + (10 * b.a) + (100 * c.a)) DAY AS DATE FROM (SELECT 0 AS a UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL SELECT 5 UNION ALL SELECT 6 UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9) AS a CROSS JOIN (SELECT 0 AS a UNION ALL
SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL SELECT 5 UNION ALL SELECT 6 UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9) AS b CROSS JOIN (SELECT 0 AS a UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL SELECT 5 UNION ALL SELECT
6 UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9) AS c ) a WHERE a.Date >= '2022-02-22' AND a.Date < '2022-03-2' ;

 

pgsql生成一段連續日期

https://www.cnblogs.com/star521/p/13435258.html