-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Friday 01 August 2003 08:56, Jodi Kanter wrote: > I have one table that has a date/time field in it. I'd like to identify > the records in the database where the date/time fields are the same. How > can I do this? Do I need to create a view or temp table? Is there a way > to run through one table multiple times.
SELECT date_trunc('month', date_column), ... GROUP BY date_trunc('month', date_column) HAVING count(primary_key) > 1; Replace date_trunc('month', date_column) with whatever you want to group it by. Note that date_part can give you interesting groupings (all the Decembers, all the 1st of the months, all the Fridays, etc...) If you want to run through it several times, you can have a sub-select in the from clause. You could also save the results in a temp table. - -- Jonathan Gardner <[EMAIL PROTECTED]> Live Free, Use Linux! -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQE/M8HgWgwF3QvpWNwRAsUNAKCLnB6vajJ8fuS7IRgp0pYxp6YaxgCg2qbk juL5a4tM1la0zmP81PdxS/c= =N8Q/ -----END PGP SIGNATURE----- ---------------------------(end of broadcast)--------------------------- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly