MySQL query help

wxdqz

New Member
I have a table with poll alternatives as well as results. One column for the alternatives and with the amount.
Yes | 16
No | 12
...etc

Right now I do two queries to get the percentage of each alternative.
select sum(amount) from poll;
and
select alt, amount from poll;

Then I can calculate the % of each alt.

Is it possible to do a smarter query and get the % value right away?
Something like,
select alt, amount/sum(antal) from poll;

TiA!
 
Back
Top