我暂时有这个问题。当我在Phpmyadmin“ SQL”窗口中运行以下查询时:
select ifnull(e.week,'Average Score') AS 'Week of', ifnull(e.team,'All Teams')
AS team, e.sort AS sort, e.setinorder AS setinorder, e.shine AS shine,
e.standardize AS standardize, e.sustain AS sustain, e.total as total
from (select str_to_date(concat(yearweek(date_scored,0),' monday'),'%X%V %W') AS week,
pt_description AS team,
round(avg(case when 5S_Desc = 'SORT' then val_num else NULL end),1) AS sort,
round(avg(case when 5S_Desc = 'SET IN ORDER' then val_num else NULL end),1) AS setinorder,
round(avg(case when 5S_Desc = 'SHINE' then val_num else NULL end),1) AS shine,
round(avg(case when 5S_Desc = 'STANDARDIZE' then val_num else NULL end),1) AS standardize,
round(avg(case when 5S_Desc = 'SUSTAIN' then val_num else NULL end),1) AS sustain,
round(avg(val_num),1) as total
from 5s_audit
WHERE
MONTH(date_scored) = MONTH(CURRENT_DATE())
AND YEAR(date_scored) = YEAR(CURRENT_DATE())
group by pt_description, str_to_date(concat(yearweek(date_scored,0),' monday'),'%X%V %W')with rollup) e
order by team desc, week desc
我得到这个结果:
这正是我所需要的。但是,当我使用相同的查询在phpmyadmin中创建视图时,得到以下信息:
每支球队的“平均得分”(在“周数”列中)消失在视野中,并被替换为最高日期。我的查询有什么问题吗,或者有人知道如何解决此问题?我正在使用MariaDB 10.3.11和PHP 7.2.2运行phpmyadmin 4.8.5。