SELECT COUNT(*) FROM table where xh = 'xxx'
如果结果大于1, 就表明有重复的字段值

解决方案 »

  1.   

    select count(xh) as 重复数,xh from T
    group by xh
      

  2.   

    select * from 
    (
    select count(*) as cnt,xh from T
    group by xh
    ) a
    where a.cnt>1
      

  3.   

    select * from yourtable where (select count(xh) from yourtable)>1
      

  4.   

    select xh from yourtable group by xh having count(xh)>1
      

  5.   

    如果想显示所有学号为重复记录的话则:
    select * from yourtable where xh in(select * from student where (select count(id) from student)>1)