<p>I am trying to accomplish the following in MySQL (see <code>pseudo</code> code)</p>

<pre><code>SELECT DISTINCT gid
FROM `gd`
WHERE COUNT(*) &gt; 10
ORDER BY lastupdated DESC
</code></pre>

<p>Is there a way to do this without using a (SELECT...) in the WHERE clause because that would seem like a waste of resources.</p>

```
```
SELECT COUNT(*)
FROM `gd`
GROUP BY gid
HAVING COUNT(gid) > 10
ORDER BY lastupdated DESC;
```
```
EDIT (if you just want the gids):
```
```
SELECT MIN(gid)
FROM `gd`
GROUP BY gid
HAVING COUNT(gid) > 10
ORDER BY lastupdated DESC
```
```