A
A
aznhautroalvyl2018-10-13 12:29:57
PostgreSQL
aznhautroalvyl, 2018-10-13 12:29:57

Partial search on date data type?

There is a table with records. The table has a field with data type date
How to search for a specific year , month or specific week ?
Tried to use LIKE, but it doesn't work with date field type:

select * from exampleTable where dateValue like '2018%';

Error log

ERROR: operator does not exist: date ~~ unknown
LINE 1: select * from events where date like '2018%';
^
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dimonchik, 2018-10-13
@dimonchik2013

you make them a date, but they don't care varchar

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question