Is there a way to compare two dates in the same table like this:
SELECT * FROM mytable WHERE date_1 = date_2;
I am looking for the simplest approach to do this as part of an update statement.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes, you can do that. Simple as that.
Have a look at the
date/timedata types in PostgreSQL.You may have to pay special attention if your “date”, in fact, is a
timestamp. By default up to 6 fractional digits are saved, can be tricky with the equality operator. You might cast totimestamp(0)to round to seconds or usedate_trunc()to truncate to one of various time units.