I cant figure out how to make this work, i tried a lot of different ways but i didn't found working one, so please help me:)
my current query looks like:
SELECT * FROM `police`
WHERE skadenca BETWEEN DATE(now())
AND adddate(current_date, interval +1 month)
AND produkt LIKE 'avto'
AND statusobnove=0 AND status=0
so just like i already said i want to grab all data from current month and next month.
ty
There is more than one way to understand your question.
Between current date and end of next month would phrase as:
where
skadenca >= current_date
and skadenca < date_format(current_date, '%Y-%m-01') + interval 2 month
Between the start of current month and the end of next month would be:
where
skadenca >= date_format(current_date, '%Y-%m-01')
and skadenca < date_format(current_date, '%Y-%m-01') + interval 2 month
Between the current date and one month ahead would be:
where
skadenca >= current_date
and skadenca < current_date + interval 1 month
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.