tags:

views:

153

answers:

1

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?

+2  A: 

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.)

bobince