where count( * )>2????????/?
这样写错了,
那要是通过子查询,怎么写?

解决方案 »

  1.   

    where (select count(*) from tb where 条件) >2
      

  2.   

    declare @t table(id int)
    insert @t select 1
    insert @t select 1
    insert @t select 3
    insert @t select 4
    insert @t select 4
    insert @t select 5select *
    from @t
    group by id
    having count(1) > 1/*id          
    ----------- 
    1
    4(所影响的行数为 2 行)
    */
      

  3.   

    select count(1) from tb have count(1) > 2 
      

  4.   

    where count( * )> 2????????/? 
    这样写错了, 
    那要是通过子查询,怎么写?select id from tb group by id having count(*) > 2
      

  5.   

    .....
    group by ... having count(*) > 2
      

  6.   

    select col1,sum(col2),count(*) from table 
    group by col1 
    having count(*) >  2