From: Mike Johnson 

> From: Robert Reed [mailto:[EMAIL PROTECTED]
> 
> > This seems like it should be easy, and I'd be happy
> > for a simple reference to where in the manual or in
> > Paul's book I can find the answer.  I am wanting to
> > find basically the inverse of a SELECT DISTINCT
> > operation.  I have a table with a column labled
> > date_created.  I know that some records (about 30)
> > were created at the exact same time (to the second) as
> > another record.  I would like to find the records that
> > have a date_created value equal to another record.  Is
> > this possible in 3.23.54?
> > 
> > Thanks in advance
> 
> Try this:
> 
> SELECT date_created, COUNT(*) AS num 
> FROM tablename 
> GROUP BY date_created 
> HAVING num > 1;
> 
> HTH!

Oof. On re-reading this, I realized I wasn't entirely specific enough.

What this'll return is all date_created values that have more than one record and a 
count of how many.

The legwork after that is to select all the rows that have each of those date_created 
values, but that's not exactly a scalable solution.

Come to think of it, I'm not entirely sure, off the top of my head, how to get the 
records themselves.

Sorry for the confusion!


-- 
Mike Johnson
Web Developer
Smarter Living, Inc.
phone (617) 886-5539


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to