views:

21

answers:

1

Hi, I have 2 columns in an "entries" table: a non-unique id, and a date stamp (YYYY-MM-DD). I want to select "all of the entry id's that were inserted today that have never been entered before."

I've been trying to use a subquery, but I don't think I'm using it right since they're both performed on the same table. Could someone help me out with the proper select statement? I can provide more details if need be.

+2  A: 

Disclaimer: I don't have access to a mysql database right now, but this should help:

select
  e.id
from
   entries e
where
   e.date = curdate() and
   e.id not in
     (select id from entries e2 where e2.date < e.date)
Brandon Horsley
i think that may have done it! verifying... :)
taber
thanks a bunch.
taber