Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 22D0F4760E3 for ; Wed, 18 Sep 2002 12:26:57 -0400 (EDT) Received: from mail.layer10.com (mail.rewireit.com [65.120.155.12]) by postgresql.org (Postfix) with ESMTP id 7E151476032 for ; Wed, 18 Sep 2002 12:26:56 -0400 (EDT) Received: from ascltdeldh24n60.nashlinux.com (h-64-105-244-165.ATLNGAHP.covad.net [64.105.244.165]) by mail.layer10.com (8.10.2/8.10.2) with ESMTP id g8IGKZ821551 for ; Wed, 18 Sep 2002 11:20:35 -0500 Message-Id: <5.1.1.6.2.20020918111926.00a82058@mail.nashlinux.com> X-Sender: smileyq@mail.nashlinux.com X-Mailer: QUALCOMM Windows Eudora Version 5.1.1 Date: Wed, 18 Sep 2002 11:26:26 -0500 To: pgsql-sql From: Sloan Bowman Subject: Creating a field that uses totals other fields? Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200209/204 X-Sequence-Number: 9481 I am wanting to create a table that will sum up the total of an order and automatically put value in the specified field. An example of the table is below. Any ideas on how to do this. CREATE TABLE sales_info ( sales_id serial PRIMARY KEY, prod_id int REFERENCES product (prod_id), qty int, unit_price numeric(4,2), sub_total numeric(4,2), tax numeric(4,2), shipping numeric(4,2), grand_total numeric(4,2)); The grand total is where I want the sum of the unit_price, tax, and shipping price entered automatically. Thanks for any help. --Sloan