SELECT timestamp, TIMESTAMP_TRUNC(timestamp, HOUR) AS `時`, TIMESTAMP_TRUNC(timestamp, MINUTE) AS `分`, TIMESTAMP_TRUNC(timestamp, SECOND) AS `秒`, ride_id, latitude, longitude, meter_reading, ride_status, passenger_count FROM taxirides.realtime ORDER BY timestamp DESC LIMIT 1000 ) # calculate aggregations on stream for reporting: SELECT ROW_NUMBER() OVER() AS `ダッシュボード_ ソート`, `分`, COUNT(DISTINCT ride_id) AS `乗⾞合計`, SUM(meter_reading) AS `収益合計`, SUM(passenger_count) AS `乗客合計` FROM streaming_data GROUP BY `分`, timestamp