select * from tab 
where col in (
  select col from tab group by col having count(col)>2)

解决方案 »

  1.   

    select * from tab_name where (col1,...,coln) in 
    (select * from tab_name group by col1,...,coln having count(*)>2);
      

  2.   

    为什么单独的select col from tab group by col having count(col)>2)
    这个句子不能运行而放在where字句中就能运行呢?
    还有其他方法没有呢?
      

  3.   

    select col from tab group by col having count(col)>2
    这个语句能运行
    而select * from tab group by col having count(col)>2)
    这个语句就不能运行了,为什么 ?
    而我将select * from tab 
    where col in (
      select col from tab group by col having count(col)>2)
    改为
    select * from tab 
    where col in (
      select * from tab group by col having count(col)>2)时
    提示我说too many values,这是怎么回事啊 ??
      

  4.   

    因为group by语句有一定限制,就是select 的内容必须在group by中或用集合函数count,max等
      

  5.   

    我把select col from tab group by col having count(col)>2改为
    select col,col1  from tab group by col having count(col)>2
    运行也出错,怎么回事,多加一个表里的字段就不行嘛?
      

  6.   

    sql语句语法没搞清楚,不应该
      

  7.   

    select col1,..,coln  from table  group by  col1,..,coln having  count(*)>2;
      

  8.   

    SELECT 后面跟几项GROUP BY 后面就要跟几项,再加HAVING COUNT(1)>2就行了。