-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Open
Description
Bug Report for https://neetcode.io/problems/sql-the-latest-login-in-2020
The question states that time_stamp will be a datetime object, and as the runner is postrgresql, EXTRACT(YEAR from...) should work?
Query:
SELECT user_id, MAX(time_stamp) AS last_stamp
FROM logins
WHERE EXTRACT(YEAR from time_stamp) = 2020
GROUP BY user_id
Error:
Error
function pg_catalog.extract(unknown, character varying) does not exist
Accepted Solution:
SELECT user_id, MAX(time_stamp) AS last_stamp
FROM logins
WHERE time_stamp >= '2020-01-01' AND time_stamp < '2021-01-01'
GROUP BY user_id
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels