在为查询定义的代码中,向我显示前3个结果
SELECT TOP 3 C.NameCity
FROM Users_A AS A, Cities AS C
WHERE (((A.UserEconomicStatus)="מבוסס") AND ((A.UserCity)=[C].[NumCity]))
GROUP BY C.NameCity
ORDER BY Count(*) DESC;
但这是查询返回的内容 https://ibb.co/dtkjJJ 5结果
答案 0 :(得分:0)
据推测,您正在使用MS Access。在MS Access中top
的行为类似于top with ties
。您需要一个额外的密钥才能使分类稳定。
这样的事情:
SELECT TOP 3 C.NameCity
FROM Users_A AS A JOIN
Cities AS C
ON A.UserCity = [C].[NumCity]
WHERE A.UserEconomicStatus = "מבוסס"
GROUP BY C.NameCity
ORDER BY Count(*) DESC, C.NameCity;