You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/* final batch */
update users as t1 join (
select id,
case
when begin_at between '2020-01' and '2020-05' then 1
when begin_at in ('2020-06', '2020-07') then 2
when begin_at in ('2020-10', '2020-11', '2021-01') then 3
else 4
end as `grouped`
from (
select
id, username, substr(str_to_date(json_extract(data, '$.cursus_users[0].begin_at'),'"%Y-%m-%dT%T.%fZ"'), 1, 7) begin_at
from users
where str_to_date(json_extract(data, '$.cursus_users[1].begin_at'),'"%Y-%m-%dT%T.%fZ"') is not null
) aa
) as t2
using (id)
set t1.`group` = t2.`grouped`
where t1.`group` is null
;
select `group`, count(*)
from users
group by `group`
;
group
The text was updated successfully, but these errors were encountered: