SQLize Online / PHPize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
with recursive rec (dt) as( select DATE('2005-07-01') union all select r.dt+1 from rec r where r.dt<DATE('2005-07-31')) select sum(case when DAYOFWEEK( dt )=1 then 1 when DAYOFWEEK( dt )=7 then 1 else0 ) weekend_days from rec

Stuck with a problem? Got Error? Ask ChatGPT!

Copy Clear