MySQL - Using COUNT(*) in the WHERE clause

前端 未结 9 1710
不思量自难忘°
不思量自难忘° 2020-11-28 20:55

I am trying to accomplish the following in MySQL (see pseudo code)

SELECT DISTINCT gid
FROM `gd`
WHERE COUNT(*) > 10
ORDER BY lastupdated DES         


        
9条回答
  •  一个人的身影
    2020-11-28 21:37

    Just academic version without having clause:

    select *
    from (
       select gid, count(*) as tmpcount from gd group by gid
    ) as tmp
    where tmpcount > 10;
    

提交回复
热议问题