From: Sloan Bowman <smileyq@nashlinux.com>
To: pgsql-sql <pgsql-sql@postgresql.org>
Subject: Creating a field that uses totals other fields?
Date: Wed, 18 Sep 2002 11:26:26 -0500
Message-ID: <5.1.1.6.2.20020918111926.00a82058@mail.nashlinux.com> (raw)
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: smileyq@nashlinux.com
Subject: Re: Creating a field that uses totals other fields?
In-Reply-To: <5.1.1.6.2.20020918111926.00a82058@mail.nashlinux.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox