SQLize Online / PHPize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
with RECURSIVE DateRange AS ( SELECT '2005-07-01' AS date UNION ALL SELECT DATE_ADD(Date, INTERVAL 1 DAY) FROM DateRange WHERE date < '2005-07-31' ) SELECT sum(case when dayofweek(date) = 6 or dayofweek(date) = 7 then 1 else 0 end) as weekend_days from DateRange

Stuck with a problem? Got Error? Ask ChatGPT!

Copy Clear