mysql - BETWEEN and DATE_ADD is not working in my case -
i have sales in database going 9 days , query not returning why?
select * `sales` date between current_date , (date_add(current_date, interval -10 day))
you have switch parameter. must lower to.
select * `sales` date between (date_add(current_date, interval -10 day)) , current_date
your current query return records greater or earlier 10 days ago, excluding range intended target.
for more informations see documentation.
if expr greater or equal min , expr less or equal max, between returns 1, otherwise returns 0. equivalent expression (min <= expr , expr <= max) if arguments of same type. otherwise type conversion takes place according rules described in section 12.2, “type conversion in expression evaluation”, applied 3 arguments.
wiki
Comments
Post a Comment