Skip to content
Advertisement

group by date and two different times in the same date in Sql

i want to select from my database the data that is

BETWEEN to date and two different times in the same date

but when I use the Sum in one of the variants it give me a wrong result

i thnik that the problem is in the group by

this is my exemple

how can i groupe the result with date but date is like this image enter image description here

Advertisement

Answer

You seem to want:


If you want to generate groups of rows that start at 4 PM until the next day at 4 PM, then we can offset the dates. A subquery comes handy for this:

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement