如何在不考虑时间的情况下按日期时间列分组 [英] How can I group by date time column without taking time into consideration

查看:26
本文介绍了如何在不考虑时间的情况下按日期时间列分组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一堆产品订单,我正在尝试按日期分组并汇总该日期的数量.如何在不考虑时间部分的情况下按月/日/年分组?

I have a bunch of product orders and I'm trying to group by the date and sum the quantity for that date. How can I group by the month/day/year without taking the time part into consideration?

3/8/2010 7:42:00 应与 3/8/2010 4:15:00

推荐答案

Cast/将值转换Date 为您的组键入.

Cast/Convert the values to a Date type for your group by.

GROUP BY CAST(myDateTime AS DATE)

这篇关于如何在不考虑时间的情况下按日期时间列分组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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