Hourly sum of values
问题 I have a table with the following structure and sample data: STORE_ID | INS_TIME | TOTAL_AMOUNT 2 07:46:01 20 3 19:20:05 100 4 12:40:21 87 5 09:05:08 5 6 11:30:00 12 6 14:22:07 100 I need to get the hourly sum of TOTAL_AMOUNT for each STORE_ID. I tried the following query but i don't know if it's correct. SELECT STORE_ID, SUM(TOTAL_AMOUNT) , HOUR(INS_TIME) as HOUR FROM VENDAS201302 WHERE MINUTE(INS_TIME) <=59 GROUP BY HOUR,STORE_ID ORDER BY INS_TIME; 回答1: SELECT STORE_ID, HOUR(INS_TIME) as