Posted by Madhivanan on 10/03/05 12:51
Use this logic
declare @t table(i int)
insert into @t values(100)
insert into @t values(200)
insert into @t values(300)
insert into @t values(100)
insert into @t values(400)
insert into @t values(100)
insert into @t values(300)
insert into @t values(600)
insert into @t values(200)
insert into @t values(600)
select i, s*100/Total as percentage from (
select i,count(i) as s ,(select count(i) from @t) as total from @t
group by i) T
Madhivanan
Navigation:
[Reply to this message]
|