没有第一个 NULL 单元格的 GROUP BY

GROUP BY without a first NULL cell

这些是我的前 10 行 table :

这就是我想要的结果:

我怎样才能得到这个结果?

是否可以编写正确的查询而不在进行分组时在名称字段中显示空行?

也许就这么简单?

SELECT t.name, other_columns, AVG(t.spent_time) FROM table t where t.name is not null and length(trim(t.name))>0
group by t.name;

分组看起来应该在 session_id_current_user 上,除了 avg max(ed) 之外的所有字段都存在检查以查看是否有名称 eg

SELECT t.session_id_current_user,
       max(t.name), max(email)...
       , AVG(t.spent_time) 
FROM table t 
where exists (select 1 from t t1 where t1.session_id_current_user = t.session_id_current_user and t1.name is not null)
group by t.session_id_current_user;