Search
 
SCRIPT & CODE EXAMPLE
 

SQL

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%';
Comment

PREVIOUS NEXT
Code Example
Sql :: mysql backup database command line 
Sql :: mysql group by date 
Sql :: stored procedure to delete data from table in mysql 
Sql :: sqlite3 import csv 
Sql :: mysql collation for all languages 
Sql :: import sql in postgresql 
Sql :: mysql timestamp format 
Sql :: else if mysql 
Sql :: between sql 
Sql :: how to check table name in current database sql 
Sql :: how to combine 2 tables in mysql 
Sql :: mysql compare timestamp in minutes 
Sql :: postgres update with if condition query 
Sql :: division by zero postgres 
Sql :: grant all privileges microsoft sql 
Sql :: sql server select last row of each item in group by column 
Sql :: change data type in mysql 
Sql :: update sqlite 
Sql :: create table with index mysql 
Sql :: SQL Add Column in a Table 
Sql :: run sql script from command line 
Sql :: call postgres function 
Sql :: mysql create table query 
Sql :: update table mysql 
Sql :: oracle select row max date 
Sql :: download sql server for mac 
Sql :: how to get previous year from sysdate in oracle 
Sql :: import data from csv to sql server 
Sql :: calculate date and convert to yearsmysql 
Sql :: mysql timezone 
ADD CONTENT
Topic
Content
Source link
Name
7+1 =