我想返回关于JOBID的效率,但是当它更改下面的查询以在mysql工作台中检查它时它不起作用。所需的查询无效。
实际查询:
select 'Efficiency' Field, avg(eff),min(eff),max(eff)
from (
select (Job_Render/(LC_Final+LC_Preview))as eff
from ras
)as s;
所需查询:
select JobID
from (
select 'Efficiency' Field,avg(eff),min(eff),max(eff) as f
from (
select (Job_Render/(LC_Final+LC_Preview))as eff
from ras
)
) as s;
答案 0 :(得分:1)
首先,您需要派生表的表别名:
select JobID
from (select 'Efficiency' as Field, avg(eff), min(eff), max(eff) as f
from (select (Job_Render/(LC_Final+LC_Preview))as eff
from ras
) s
) s;
如果要选择它,还需要一个名为JobID
的列别名。
可以想象,您可能只想按JobId
汇总:
select JobId, 'Efficiency' as Field, avg(eff), min(eff), max(eff) as f
from (select ras.*, (Job_Render/(LC_Final+LC_Preview))as eff
from ras
) s
group by JobId;