I have a table as below. I want to query specific dates from the table. The dates are random and therefore i do not want to use the BETWEEN keyword. Also, the number of dates that i want to query could vary from one to many(for simplicity lets say 2 distinct dates.
create table temptable(id serial primary key not null,myTimestamp timestamp);
insert into temptable(myTimestamp) values ('2020-09-25 02:02:51.99');
insert into temptable(myTimestamp) values ('2020-08-24 12:20:51.111');
insert into temptable(myTimestamp) values ('2020-09-23 13:20:51.286');
The following query is executed hoping to get two distinct dates.
select *
from temptable
where myTimestamp::date = date '2020-09-23'
and myTimestamp::date = date '2020-08-24';
The above query executes on pgadmin but nothing is listed on the table. If i use OR operator, i can see one date returned but that i not what i want. I want both the dates
Please advice
Thanks
OR, notAND. When you useORyou only see one row, because there is no row for2020-08-24(only for2020-09-24)