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.
update help?
Moderator: General Moderators
Re: update help?
can try like this:
Code: Select all
UPDATE act SET avg = round(marks/550 *100,2);- AbraCadaver
- DevNet Master
- Posts: 2572
- Joined: Mon Feb 24, 2003 10:12 am
- Location: The Republic of Texas
- Contact:
Re: update help?
Set the field type in the database to correctly store your number.iamngk wrote:can try like this:
Code: Select all
UPDATE act SET avg = round(marks/550 *100,2);
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.