Welcome Guest, Not a member yet? Register   Sign In
MySQL Multiplication seems slightly weird
#6

[eluser]bapobap[/eluser]
Think I might have figured it out, the column name that stores the rating of a single review (loads of which make up the average) is called rating. It seems MySQL was multiplying one of these by 20, instead of my new average value that I was calling rating.

rating * 20.0 took the rating field of a review and multiplied it by 20 rather than my newly created average. This was even though I was grouping the reviews together and wasn't even including that column anywhere for the result.

So I called it something random, AS total_rating, but ->select('total_rating * 20.0 AS percentage') tells me there is no column called total_rating.

I'm not sure why that's happening, any ideas on that one?!

Thanks again


Messages In This Thread
MySQL Multiplication seems slightly weird - by El Forum - 01-20-2009, 03:06 PM
MySQL Multiplication seems slightly weird - by El Forum - 01-20-2009, 04:04 PM
MySQL Multiplication seems slightly weird - by El Forum - 01-20-2009, 04:13 PM
MySQL Multiplication seems slightly weird - by El Forum - 01-20-2009, 04:23 PM
MySQL Multiplication seems slightly weird - by El Forum - 01-20-2009, 04:31 PM
MySQL Multiplication seems slightly weird - by El Forum - 01-20-2009, 05:48 PM
MySQL Multiplication seems slightly weird - by El Forum - 01-20-2009, 10:17 PM
MySQL Multiplication seems slightly weird - by El Forum - 01-20-2009, 11:01 PM



Theme © iAndrew 2016 - Forum software by © MyBB