List:General Discussion« Previous MessageNext Message »
From:Tom Norwood Date:July 27 2002 6:39pm
Subject:Date Comparison Problem...
View as plain text  
Just when I thought I was getting the hang of this mysql stuff, the simplest
of tasks
is causing me to think about pulling my hair out.

My table:

   NEWS {
     newsID (INT(3), AUTO-INCREMENT),
     newsTitle (VARCHAR (50)),
     newsText (BLOB),
     newsDate (DATE)
   }

I just want to filter OUT any rows that have a 'future' date value in
'newsDate' column.
(ie. Don't select any news that hasn't happened yet!)

Query, I gather the WHERE clause deals with YYYY-MM-DD formatted dates:

   SELECT * FROM news
     WHERE newsDate < DATE_ADD(CUR_DATE(), INTERVAL 1 DAY)
     ORDER BY newsDate DESC

If I take out the WHERE clause the whole table gets SELECT-ed, it works
fine:

   SELECT * FROM news
     ORDER BY newsDate DESC

Any assistance gratefully Rx'd.  I have DuBois's MySQL, it's obviously too
good for me.
Also tried various searches on MySQL.com, with little joy, aaaaaahh!

Tom.

Thread
Date Comparison Problem...Tom Norwood28 Jul
  • Re: Date Comparison Problem...Paul DuBois28 Jul