Removing groups of similar records in MySQL query

Posted by user1182155 on Stack Overflow See other posts from Stack Overflow or by user1182155
Published on 2013-10-25T03:48:04Z Indexed on 2013/10/25 3:54 UTC
Read the original article Hit count: 158

Filed under:

I'm trying to wrap my head around this... (it may be simple, been a long day!)

I have a database with sometimes multiple similar records...

ie.

Apples 2008-09-03
Apples 2012-01-01
Apples 2013-10-24
Oranges 2012-01-04

What I need to do is do a query that will show only records that haven't been updated today...

So in this case, since Apples has an entry that was updated today, none of the records for the Apples should appear in the results.

Oranges should be the only record it returns.

I have a query similar to this...

SELECT fruit FROM fruitnames where date < CURDATE()

Which works to remove the record that was updated today... But it keeps the other records for Apples (obviously)...

How would I remove those results as well?

© Stack Overflow or respective owner

Related posts about mysql