Filter by data and current_date

Hello Guys

I have a field in my table that keeps date and time, but I need to filter the field only by current_date, how can I do that?

SELECT * FROM TABLE A
WHERE A.DATA=CURRENT_DATE

Something like my example
thanks
LVL 1
hidrauAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
Julian HansenConnect With a Mentor Commented:
Is TABLE the name of your table? TABLE is a reserved word so you should back tick it if you are using it as a name

The current date is returned by the function NOW()

To ensure you are comparing only the Date parts of potential date/time fields use the DATE() function to only return the date elements.

SELECT * FROM `TABLE` A WHERE DATE(A.date) = DATE(NOW());

Open in new window

1
 
Kim WalkerConnect With a Mentor Web Programmer/TechnicianCommented:
I have a field in my table that keeps date and time
Your field has both date and time? But you want to filter on date only, correct? Try:
SELECT * FROM TABLE A
WHERE DATE(A.DATA)=CURRENT_DATE

Open in new window

1
 
hidrauAuthor Commented:
thanks a lot
0
 
Julian HansenCommented:
You are welcome.
0
All Courses

From novice to tech pro — start learning today.