Question

Can anyonen help with Teradata?

I want to create a query that is a standard

select count(*) from Table where Column = Something

but has a group by time period done by 5 minute time intervals the time column is in 'Time' format

any idea?

Was it helpful?

Solution

Something like:

SELECT HOUR(timecolumn) AS h, MINUTE(timecolumn)-(MINUTE(timecolumn) MOD 5) AS m, COUNT(*)
FROM table
WHERE column=something
GROUP BY h, m

(SQL:2003's FLOOR is a common way to do periodic grouping, but I believe Teradata doesn't support it, hence the n-(n MOD m) construct.)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top