Question

How do I search by day

I have a table with a date field with format: 2012-11-19 and i wish to SELECT results by day.

My Html: Search by day eg Tuesday

Then Mysql:

SELECT * FROM table WHERE date = Tuesday

And I will get results from Tuesdays only

Was it helpful?

Solution

Try this:

SELECT * FROM table WHERE DAYNAME(date) = 'Tuesday'

Check the link DAYNAME Function

OTHER TIPS

Use WEEKDAY()

SELECT * FROM table 
WHERE weekday(`date`) = 1
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top