这种结果?
SELECT RTRIM(COUNT(DISTINCT type)) +'/' + RTRIM(COUNT(*)) FROM tb

解决方案 »

  1.   

    select px * 100.0/px2 as cnt
    from (select count(distinct type) as px from ta) a,
    (select count(1) as px2 from ta)
      

  2.   

    Declare @t table(id int identity,[type] varchar(2))
    Declare @a float
    insert @t select 'aa' 
    insert @t select 'bb'
    insert @t select 'bb'
    insert @t select 'cc'
    insert @t select 'cc'
    insert @t select 'aa'
    insert @t select 'dd'
    insert @t select 'aa'Select @a=count(*) from @t
    Select [type],cnt=count([type])/@a From @t group by [type]
    Select [type],cnt=rtrim(count([type]))+'/'+rtrim(@a) From @t group by [type]
    要哪个结果?