0

I am unclear how to write a query where I want all the entries in a specific month and date format from a MySQL table. I am not using DATE_FORMAT() with a NOW() correctly. I need to write a query that has a time field in the yyyy-mm-dd format to return all entries that match today’s month and date. I would appreciate your assistance.
Thanks
WBR

1
Contributor
2
Replies
3
Views
9 Years
Discussion Span
Last Post by rouse
0

I should list what I have tried:
SELECT DATE_FORMAT(NOW(), '%M %D') returns "December 27th"

And

Select * from TIME_TABLE
Where
Extract(month from DATE_FIELD ) = 12
and
Extract(day from DATE_FIELD ) = 26
order by DATE_FIELD, DESCRIPTION

returns a result set, but

Select * from TIME_TABLE
Where
Extract(month from DATE_FIELD ) = DATE_FORMAT(NOW(), '%M')
and
Extract(day from DATE_FIELD ) = DATE_FORMAT(NOW(), '%D')
order by DATE_FIELD, DESCRIPTION

Returns an empty result set, so I think I need to figure out how to get the month and date as intergers.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.