that's correct, this will ~always~ return zero rows
Originally Posted by YBH305
the reason is because of how BETWEEN works
when you use BETWEEN, you ~must~ put the lower value first
here's how it works...
today is 2010-01-05, so yesterday is 2010-01-04
your BETWEEN statement would be --
BETWEEN is always evaluated as two greater/less-than-or-equal comparisons, so this is equivalent to --
WHERE currentDate BETWEEN '2010-01-05' AND '2010-01-04'
and it's impossible for a single currentDate value to be both >= 5th and <= 4th at the same time!!
WHERE currentDate >= '2010-01-05'
AND currentDate <= '2010-01-04'
make sense now?