开发者

SQL: Group by "business days"

I would like to group a search result by days, but unfortun开发者_开发百科ately, the definition is not a day from midnight to midnight (00:00-24:00), but from 06:00 to 06:00.

Any easy solution? If possible in PL-SQL


It should be as simple as this:

GROUP BY TRUNC(DATE - 6/24)

- 6/24 subtracts 6 hours from the datetime in the column DATE and thus all times between 06:00 and 06:00 will be the same day. TRUNC then removes the time part as you only need the date.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜