How do I get weekdays in MYSQL?

I have two columns StartDate and EndDate. My table looks like this:

StartDate  | EndDate 
2015-05-05 | 2015-05-05
2015-07-10 | 2015-07-13

I used this query to get consecutives days:

DATEDIFF(EndDate, StartDate)+1 AS consecutive_days 

But this counts also the weekends. Is there a way in mysql to avoid that ? thx

so the result of my example should be :


Source: mysql

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.