Page 1 of 1

update help?

Posted: Sat Feb 20, 2010 1:04 am
by adilmarwat2004
I have table in mysql name "act" contains 4 fields

id, name, marks, avg(float)

I give the query to sql as

UPDATE act SET avg = marks/550 *100

I want that the result (avg) in field should be 2 decimal point not more.
like 72.63 not 72.6333

How it is possible.

Please Help.

Re: update help?

Posted: Mon Feb 22, 2010 4:37 am
by iamngk
can try like this:

Code: Select all

UPDATE act SET avg = round(marks/550 *100,2);

Re: update help?

Posted: Mon Feb 22, 2010 9:59 am
by AbraCadaver
iamngk wrote:can try like this:

Code: Select all

UPDATE act SET avg = round(marks/550 *100,2);
Set the field type in the database to correctly store your number.