我正在处理这些查询,但每次运行它都会显示错误
#1054 - 未知栏' gen_cityname'在' where子句'虽然列中有列
SET @rownum := 0;
SELECT bgycode, scc_bgyscoretotal
FROM (
SELECT @rownum := @rownum + 1 AS bgycode,
scc_bgyscoretotal,id
FROM bgyprofile
ORDER BY scc_bgyscoretotal DESC
) as result
WHERE gen_cityname=XXXXXX;
答案 0 :(得分:0)
列gen_cityname在where子句中使用但在结果表中找不到。在select中输入gen_cityname,如下所示。
SELECT @rownum := @rownum + 1 AS bgycode,
scc_bgyscoretotal,
id,
gen_cityname
FROM bgyprofile
ORDER BY scc_bgyscoretotal DESC