Mysql Search by day

406 Views Asked by At

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

2

There are 2 best solutions below

2
On BEST ANSWER

Try this:

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

Check the link DAYNAME Function

0
On

Use WEEKDAY()

SELECT * FROM table 
WHERE weekday(`date`) = 1