我想执行一个查询,计算商店中截止日期在 open_date 60 天内的行数。
示例:表 A
Store Open Date Close Date
A 2017-01-01 2017-01-31
B 2017-02-02 Null
A 2017-01-02 2018-01-21
提前致谢。
最佳答案
使用 datediff()
SELECT count(*) FROM [Table A] WHERE datediff(Close_date,Open_date) <= 60;
关于mysql - 如何统计某天内的行数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49062521/