Created
November 11, 2024 02:46
-
-
Save ardianta/f55732fb75b4254ac1fbfef4ca751e1e to your computer and use it in GitHub Desktop.
Query to show the most active booking hours
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
HOUR(CONVERT_TZ(`bookingCreatedAt`, '+00:00', '+08:00')) AS jam, -- convert UTC time to local time +08:00 | |
COUNT(*) AS total_booking | |
FROM | |
Booking -- table name | |
WHERE | |
YEAR(`bookingCreatedAt`) = 2024 AND MONTH(`bookingCreatedAt`) = 10 -- month of year 2024 | |
GROUP BY | |
jam | |
ORDER BY | |
jam LIMIT 100 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Query Result:
