mysql获取近7天日期

2023-12-25 19:12:20
SELECT
      date_sub( curdate( ), INTERVAL 7 DAY ) AS a UNION
      SELECT
      date_sub( curdate( ), INTERVAL 6 DAY ) AS a UNION
      SELECT
      date_sub( curdate( ), INTERVAL 5 DAY ) AS a UNION
      SELECT
      date_sub( curdate( ), INTERVAL 4 DAY ) AS a UNION
      SELECT
      date_sub( curdate( ), INTERVAL 3 DAY ) AS a UNION
      SELECT
      date_sub( curdate( ), INTERVAL 2 DAY ) AS a UNION
      SELECT
      date_sub( curdate( ), INTERVAL 1 DAY ) AS a
      FROM DUAL

在这里插入图片描述

文章来源:https://blog.csdn.net/zhouzaig/article/details/135202692
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。