2

I have one table in postgresql and my table contain one column of timestamp without timezone

i want to write one query which will check if same date inserted multiple times or not if same date present more than once query should return that date

like 12 Sep 2011,12 Sep 2011,12 Sep 2011,10 Sep 2011,

Here 12 Sep 2011 date is present more than once how to write query for that

2 Answers 2

9
SELECT my_date FROM my_table GROUP BY my_date HAVING COUNT(my_date) > 1
Sign up to request clarification or add additional context in comments.

Comments

1

If you have timestamps, you should drop the 'time' part:

SELECT time_column::DATE FROM my_table GROUP BY time_column::DATE HAVING COUNT(*) > 1

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.