Sumon
Sumon

Reputation: 299

mysql where date is on Monday

I am trying to query MySQL database all the record where date is on Monday or Tuesday like query would be

select count(*) from table where date = Monday;

what would be best way to execute that query in mysql workbench

thanks

Upvotes: 4

Views: 5684

Answers (1)

Blank
Blank

Reputation: 12378

Try function weekday:

select count(*) from table where weekday(date) = 0;

And see official doc here.

As @Psi said, if you will concern performance, you should avoid function, and you'd better create a new column to store weeday.

Upvotes: 9

Related Questions