Answers for "PSQL use LIKE with timestamps"

SQL
0

PSQL use LIKE with timestamps

-- This throws the following error, being
-- updated's type timestamp with time zone
SELECT COUNT(*) FROM model WHERE updated LIKE '2021-10-17%';
ERROR:  operator does not exist: timestamp with time zone ~~ unknown

-- Cast timestamp to VARCHAR
SELECT COUNT(*) FROM amodel WHERE CAST(updated AS VARCHAR) LIKE '2021-10-17%';
Posted by: Guest on October-18-2021

Code answers related to "SQL"

Browse Popular Code Answers by Language