N
|
nitinjainDevClub member 8/2/2010 |
Hi all, I have a tables with two fields that are entered manually by the user 'Project Value £' and 'Project Profitability £'. I have a third field in the same title entitled 'Project Profitability %'. The value for this field should be obtained by the following calculation Project Value £ / Project Profitability £. I would like this to happen automatically when the fields are entered or at least when the record is added to the database. Please can someone point me in the right direct as to what I need to look at in order to resolve this problem. Regards, Den.
|
S
|
swanside 8/2/2010 |
Add the calculation code to the Before Record Added/Edited event.
-- phpMyAdmin SQL Dump -- version 3.2.5 -- http://www.phpmyadmin.net -- -- Host: localhost -- Generation Time: Aug 02, 2010 at 02:33 PM -- Server version: 5.1.34 -- PHP Version: 5.2.9-2 SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; /!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT /; /!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS /; /!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION /; /!40101 SET NAMES utf8 /; -- -- Database: percent -- -- -------------------------------------------------------- -- -- Table structure for table percent -- CREATE TABLE IF NOT EXISTS percent (ProjectValue£ varchar(10) NOT NULL,ProjectProfitability£ varchar(10) DEFAULT NULL,KEY ProjectValue£ (ProjectValue£ )) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table percent -- INSERT INTO percent (ProjectValue£ , ProjectProfitability£ ) VALUES('100', '10');
SELECT ProjectValue£ ,ProjectProfitability£ ,(select sum( ProjectValue£ /ProjectProfitability£ )) AS Profitability% FROM percent
|