我正在尝试在 MySQL 中完成以下操作(请参阅 pseudo
代码)
I am trying to accomplish the following in MySQL (see pseudo
code)
SELECT DISTINCT gid
FROM `gd`
WHERE COUNT(*) > 10
ORDER BY lastupdated DESC
有没有办法在 WHERE 子句中不使用 (SELECT...) 来做到这一点,因为这看起来像是在浪费资源.
Is there a way to do this without using a (SELECT...) in the WHERE clause because that would seem like a waste of resources.
试试这个;
select gid
from `gd`
group by gid
having count(*) > 10
order by lastupdated desc
这篇关于MySQL - 在 WHERE 子句中使用 COUNT(*)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!