MySQL Forums
Forum List  »  Newbie

Dividing two columns in mysql
Posted by: Ric Gauci
Date: March 07, 2014 07:58AM

Hi - I have tried a few tricks on line but I cant get the correct answer. The multiply by 100 is to get result as a %

Code:
SELECT Team, ROUND(SUM(GOALS/(GOALS+BEHINDS)),2)*100 AS ACCURACY

FROM `MatchDetails`
WHERE Season = 1898
GROUP BY Team

Both GOALS and BEHINDS are FLOAT (Have tried as INT but get same result)

An example of my results would be... the mathematical equation for team A = 51/(51+90)*100 which should be 36.43 but I get a result of 579.00 I have tried in vein to find an answer on line - Can anyone please help me out?

Cheers

Options: ReplyQuote


Subject
Written By
Posted
Dividing two columns in mysql
March 07, 2014 07:58AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.