Reputation: 1957
I am attempting to view two columns from my table, *received_on* and *closed_on*. I also wanted a third column that counted how many saturdays existed between the two dates in each row.
So far, I was thinking something like
where year(date)=2011 and weekday(date)=5
So my question again is how can I count how many Saturdays exist between two dates in each row?
EDIT
Row 1:
received_on 2013-11-29 closed_on 2013-12-02
Row 2:
received_on 2013-12-4 closed_on 2013-12-09
Upvotes: 3
Views: 3780
Reputation: 26784
SELECT received_on,closed_on, FLOOR(DATEDIFF(DATE(received_on), DATE(closed_on))/7) as numofsat FROM table
Upvotes: 3