MySQL Forums
Forum List  »  Newbie

Re: Decipher three lines of code
Posted by: Peter Brawley
Date: July 02, 2015 11:23AM

If j.date >= 1 day ago, j.date must be >= 15 days ago, and if either is the case then j.date > '2015-01-01' unless the server date has been hacked, so the first two clauses are superfluous. And the formatting functions are also redundant, since the format in which MySQL stores dates isn't variable.

So, it's an idiotically redundant test of whether j.date is today or later.

If j.date is a Date column, (j.date >= curdate() ) would suffice.

If j.date is Datetime, ( date(j.date) >= curdate() ) or left(j.date,10) >= curdate() would do.

Options: ReplyQuote


Subject
Written By
Posted
Re: Decipher three lines of code
July 02, 2015 11:23AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.