Quantcast
Channel: Teradata Forums - All forums
Viewing all articles
Browse latest Browse all 100

Grouping while combining Date and Hour - forum topic by mrjkirkpatrick

$
0
0

Hello,
I couldn't find exactly this question among the great date/time posts on the forum.
I have a date field (row_added_ts) with the format: "12/29/2014 6:34:42 PM"
My end goal is to group 'cases' by the hour, but with the date included (so a simple HOUR EXTRACT seemingly won't work).
e.g:
--

SELECT row_added_ts original_time,
count(distinct case_id) cases
FROM X.data
GROUP BY 1

--

But I would like the grouping to be by hour (not rounded).
So 1:00:00 PM - 1:59:59 PM would be grouped 1:00 PM, 2:00:00 PM - 2:59:59 PM would be grouped 2:00 PM, so forth.
Any help is appreciated.

Forums: 

Viewing all articles
Browse latest Browse all 100

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>