获取“x”周内的日期

mrwjdhj3  于 2021-06-21  发布在  Mysql
关注(0)|答案(0)|浏览(240)

我有一个查询,它会告诉我所有的日期,星期一和星期二

SELECT a.Date AS dat_e FROM ( SELECT DATE_ADD( '2018-01-17' , INTERVAL (1) DAY ) + 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 HAVING  DAYOFWEEK(dat_e) IN ( 2,3)

我想把日期定在“x”周之后,即:1、2或3周之后。日期应该是星期一和星期二

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题