문제

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?

도움이 되었습니까?

해결책

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top