I have a MYSQL news table with the fields "date_start" and "date_end" to indicate which news to display on the website. Articles are publicly available if date_start is up to today and date_end has not passed yet (after today).
Problem: I want the administrator to leave date_end NULL if the article is persistent and does not expire. This, of course, does not work with my choice:
SELECT * FROM pf_news WHERE date_start <= CURRENT_DATE() AND date_end >= CURRENT_DATE()
It leaves articles with NULL date_end . I tried to play around with IF instructions a bit, but it became difficult for me. Is there an easy way to do this, or should I just set date_end to 3000-01-01 if it is left blank? :)
date mysql
Ville
source share