select * from tbl_vote
truncate table tbl_vote
select answer, count(*) * 100/(select count(*) from tbl_vote) as Percentage,
Votes=
case answer
when 1 then 'Dog'
when 2 then 'Cat'
when 3 then 'Bird'
when 4 then 'Man'
end
from tbl_vote
group by answer
create table tbl_vote
(
vote_id int not null primary key identity,
answer int,
u_id int,
createdOn datetime
)
No comments:
Post a Comment