📜  PSQL 使用带时间戳的 LIKE - SQL 代码示例

📅  最后修改于: 2022-03-11 15:05:34.845000             🧑  作者: Mango

代码示例1
-- 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%';