我有这样一个表单内容

6ie5vjzr  于 2021-06-21  发布在  Mysql
关注(0)|答案(0)|浏览(171)

当它在phpmyadmin中创建这样的视图时,我遇到了一个问题#1349- SELECT 视图中包含子查询 FROM 我的代码是这样的请帮忙

SELECT b.ngr_tjuan, SUM (b.LFormal) AS LFormal, SUM (b.PFormal) AS PFormal, SUM (b.LFormal) + SUM (b.PFormal) AS SUMFormal,
SUM (b.LInformal) AS LInformal, SUM (b.PInformal) AS PInformal, SUM (b.LInformal) + SUM (b.PInformal) AS SUMInformal FROM
(SELECT a.ngr_tjuan,
(CASE WHEN a.sktor_pkrjaan = 'FORMAL' AND a.jk = 'L' THEN JJK ELSE 0 END) AS LFormal,
(CASE WHEN a.sktor_pkrjaan = 'FORMAL' AND a.jk = 'P' THEN JJK ELSE 0 END) AS PFormal,
(CASE WHEN a.sktor_pkrjaan = 'INFORMAL' AND a.jk = 'L' THEN JJK ELSE 0 END) AS LInformal,
(CASE WHEN a.sktor_pkrjaan = 'INFORMAL' AND a.jk = 'P' THEN JJK ELSE 0 END) US PInformal
FROM
(SELECT ngr_tjuan, COUNT (jk) AS JJK, sktor_pkrjaan, jk
FROM tbtki2
GROUP BY ngr_tjuan, sktor_pkrjaan, jk) a
WHERE a.JJK> 0) b
GROUP BY b.ngr_tjuan

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题