查询一列数字里固定数字重复个数

解决方案 »

  1.   

    select num,count(1) as 重复次数 from tb where num='固定数字' group by num 
      

  2.   

    --查看1的个数
    declare @i bigint
    set @i=114561354151
    select len(@i)-len(replace(cast(@i as varchar(20)),'1',''))/*
                
    ----------- 
    5(所影响的行数为 1 行)*/
      

  3.   

    难道是阿顺这样的??不是竖着的?

    num
    1
    2
    3
    1
    1
    还是
    11113455
    这样的?
      

  4.   


    select 列,count(1) 数目 from 表 group by 列