如何在mysql中获取当前周日期到当天? [英] How to get current week dates till current day in mysql?

查看:270
本文介绍了如何在mysql中获取当前周日期到当天?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

how to get current week dates till current day in mysql?





我的尝试:



SELECT小时,spent_on_date FROM time_entries WHERE user_id = 38和(spent_on_date< = curdate() - INTERVAL 1周);



What I have tried:

SELECT hours,spent_on_date FROM time_entries WHERE user_id=38 and (spent_on_date <= curdate() - INTERVAL 1 week);

推荐答案

如果你googlemysql get一周的第一天你会发现很多不同的方法来做到这一点。例如,请参阅 sql - 获取第一天的使用周数 - 堆栈溢出的MySql中的一周 [ ^ ]和如何在mysql中获取一周中第一天的第一天? - 堆栈溢出 [ ^ ]。
If you google "mysql get first day of week" you will find lots of different ways to do it. For example, see sql - Getting first day of the week in MySql using Week No - Stack Overflow[^] and How do I get the first day of the week of a date in mysql? - Stack Overflow[^].


这篇关于如何在mysql中获取当前周日期到当天?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆