Reputation: 21
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
Upvotes: 2
Views: 8182
Reputation: 13766
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
Upvotes: 1
Reputation: 2501
SELECT my_date FROM my_table GROUP BY my_date HAVING COUNT(my_date) > 1
Upvotes: 9