Page 1 of 1

mysql update SET problem?

Posted: Fri Feb 19, 2010 6:50 am
by adilmarwat2004
I have mysql table name 'marks' contains 4 fields

id, name, marks, avg

I give the sql query to mysql table like that

Update marks SET avg = marks/550*100

which gives result but there is no decimal value like 70.35 it shows only 70.

How it is possible.

Re: mysql update SET problem?

Posted: Fri Feb 19, 2010 7:39 am
by aravona
What is your Marks set as?

Integer = Allows whole numbers between -32,768 and 32,767

You need to make sure your data type is right.

Single = Single precision floating-point. Will handle most decimals
Double = Double precision floating-point. Will handle most decimals

http://www.w3schools.com/SQl/sql_datatypes.asp