How to implement a date comparison, cum implementation is displayed in 5 days, showing records within 10 days
A post a few days ago, about displaying this date within 5 days, http://www.oso.com.cn/forum/read.php?theme_id=7459 The main argument is to focus on Select Something from Table WHERE to_DAYS (now ()) - to_days (date_col) <= 5; on, I trials for a long time, the result is still an error, I have seen MySQL's function today, finally came out, I didn't dare to enjoy it, I posted it for everyone to study, (Although the technical content is not high, don't throw my persimmon, huh, huh) MySQL's to_days (date) function is description: Back to Date to the total number of days of the 0 year, I tested Mysql> SELECT TO_DAYS (now (0 )); -------------------------- | to_DAYS (now ()) | ---------- ---------------- | 730839 | -------------------------- out It is the total number of days from the current time, then I tried to use the above statement test; mysql> select to_days (now ()) - to_DAYS (Date_col) <= 5; results: error 1054: Unknown Column 'Date_Col' in 'Field First' This road does not pass, I tried to directly put the 5th generation to date_col to mysql> select to_days (now ()) - to_DAYS (5); results: ---------- ----------------- | To_days (now ()) - to_days (5) | ------------------ --------- | NULL | -------------------------- ? No way? Don't this do this? I will then try mysql> select. . . .