customer表
有个name 还有个country
 
查某个国家超过10个客户的客户的姓名 比如
A 美国
b 中国
c 中国
d 中国
e 中国
f 中国
g 中国
h 中国
i 中国
j 中国
k 中国
l 中国
m 中国
o 中国
p 中国 除了第一条   别的都要查出来 

解决方案 »

  1.   

    SELECT * FROM TB WHERE 
    COUNTRY IN(SELECT COUNTRY FROM TB GROUP BY COUNTRY HAVING COUNT(*)>=10)
      

  2.   

    select
     * 
    from
     tb 
    where
     country in(select country from tb group by country having count(1)>10)
      

  3.   

    select * 
    from tb t
    where (select count(1) from tb where country=t.country)>=10
      

  4.   

    select
     name,country 
    from
     TB 
    where
     country in(select country from tb group by country having count(1)>10)
      

  5.   


    select country from customer group by country having count(1) >= 10
      

  6.   

    select * from  customer where country in
    (select country from customer group by country having count(1) >= 10)
      

  7.   

    select * 
    from tb t
    where (select count(1) from tb where country=t.country)>=10