Jump to content

MySQL Where date <>


fesan

Recommended Posts

Hello...

 

Trying to not show all records that are dated older than today(at any point)

 

My query looks like this:

SELECT * FROM $dbtable WHERE date < $today ORDER BY date, getin ASC

 

This one failes for some reason. When i change the greater/smaler then to >, it gets the correct result.

My, creation of $today looks like this:

$today = date('Y-m-d');

 

I have records where the date field is older and newer than today. My date field has the date format.

 

Can some one tell me why it is failing?

Link to comment
Share on other sites

WHERE date < $today selects records that are older than $today (this is the opposite of what you stated you want to select.)

 

WHERE date >= $today selects records that are newer or the same as $today (sounds like you want to do this.)

 

WHERE date > $today selects records that are newer than $today (or this one.)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.