简体   繁体   中英

How to filter with a data which is greater than current date in sql?

filter data which is greater than current date

select * from event_participant where username='$username' AND event_date>=GETDATE()

I have been try this query but seems doesn't works

Try using CURDATE() instead of GETDATE() :

SELECT *
FROM event_participant
WHERE username = '$username'
    AND event_date >= CURDATE()

Mysql : NOW() , CURDATE()

SQL Server : GETDATE()

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