我正在尝试从表中查看两列* received_on *和* closed_on *。我还想要第三列,该列计算每行两个日期之间存在多少个星期六。
到目前为止,我在想类似
where year(date)=2011 and weekday(date)=5
所以我的问题又是我如何计算每行两个日期之间存在多少个星期六?
编辑
第1行:
received_on 2013-11-29 closed_on 2013-12-02
第2行:
received_on 2013-12-4 closed_on 2013-12-09
SELECT received_on,closed_on, FLOOR(DATEDIFF(DATE(received_on), DATE(closed_on))/7) as numofsat FROM table
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句