活字格内置的是sqlite 数据库,不支持privot,不过可以这样实现你要的效果,
select"批号",sum(case when "检验项目" ="项目1" then "结果" else null end) as "项目1",sum(case when "检验项目" ="项目2" then "结果" else null end) as "项目2"
from"检验结果表" group by "批号"
活字格内置的是sqlite 数据库,不支持privot,不过可以这样实现你要的效果,
select"批号",sum(case when "检验项目" ="项目1" then "结果" else null end) as "项目1",sum(case when "检验项目" ="项目2" then "结果" else null end) as "项目2"
from"检验结果表" group by "批号"