0

I'm trying to select the items that have expired in my database but nothing is ever returned. I've tried the following:

select * from productTable where columnExpiration < date( currentDate)

All dates in the format yyyy-mm-dd

When that didn't work I tried:

Select* from productTable where columnExpiration < currentDate

Any suggestions? This is really starting to drive me crazy. Thanks

Anju
  • 9,379
  • 14
  • 55
  • 94
Daniel Nysveen
  • 161
  • 1
  • 1
  • 4

1 Answers1

0

Try here, which has already been asked, and has a solution:

use Datetime() to format your dates before comparison.

Community
  • 1
  • 1
mjbnz
  • 683
  • 4
  • 7
  • But I've already tried several of the methods that worked for that poster such as the yyyymmdd format which IS NOT working for me. Any other suggestions? – Daniel Nysveen Oct 26 '11 at 11:12
  • I'd really appreciate some help because datatime is not working either. There has to be some other problem. here is the exact code String selectString = "SELECT * FROM "+ productTable+ " WHERE datetime("+columnExpiration+") < datetime("+currentDate+")" ; – Daniel Nysveen Oct 27 '11 at 00:36
  • Start by breaking the query down to a basic test that you can run by hand, to see that you're getting the result you need. then work your way up to the query your code will run... if that makes sense. (Sorry for slow response, I don't hang out here) – mjbnz Oct 31 '11 at 06:56