Page 1 of 1

Devide columns

Posted: Thu Jan 17, 2008 4:49 pm
by lammspillning
Ok I think this is rather basic..
How would I do if I want to devide a value in a column with a value in another column in a table?
I want to devide the value in my column "vote_sum" with the value in "vote_tot",so that I get an average value and echo it. I'm not sure how to do this..//thanx

Re: Devide columns

Posted: Thu Jan 17, 2008 5:11 pm
by pickle
This isn't a coding question - it's a databases question. I've moved the topic to the appropriate forum.

Something like this should work:
[sql]SELECT  vote_sum/vote_totalFROM  some_table[/sql]
assuming vote_sum and vote_total aren't aggregate values.