Reputation: 2935
I want to write mysql for filter weekday result only. I used timestamp for store dates. can anyone help me to this?
eg; SELECT * FROM mytable WHERE WEEKDAY('mydate_field')
Upvotes: 3
Views: 2597
Reputation: 397
you can also try like this.
SELECT * FROM your_table WHERE WEEKDAY(mydate_field)>0 AND WEEKDAY(mydate_field)<6;
Upvotes: 0
Reputation: 2729
Try something like this:
SELECT * FROM mytable
WHERE WEEKDAY('mydate_field')<5
Upvotes: 3
Reputation: 36601
Considering you mean excluding Sunday and Saturday.
SELECT * FROM mytable
WHERE DAYOFWEEK('mydate_field') in (2,3,4,5,6)
Upvotes: 5