简体   繁体   中英

Query to return values from more then 6 months ago

this is the code it have so far

$result = mysqli_query($con,"SELECT * FROM users WHERE User_Last_Login> ");

the format for user_last_login is yyyy-mm-dd

SELECT * FROM users WHERE User_Last_Login < DATE_SUB(NOW(), INTERVAL 6 MONTH)

or

SELECT * FROM users WHERE User_Last_Login < NOW() - INTERVAL 6 MONTH

or

SELECT * FROM users WHERE User_Last_Login < DATE_SUB(CURDATE(), INTERVAL 6 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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM