If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > PostgreSQL > Automatically calculate values in one table based on data in another.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-01-11, 18:07
alohascott alohascott is offline
Registered User
 
Join Date: May 2011
Posts: 1
Automatically calculate values in one table based on data in another.

I am creating an example database for a coffee shop. In the item table I have item name and item price. in order line item table I have quantity item price and extended price (quantity times price)
and in the sales order table i have subtotal, tax and total.

how do i have the database automatically insert item price in the order line item table and then calculate extended price. then take extended price from order line item and insert in subtotal of sales order table and the compute tax and total? or do i need to do this all by hand?
thanks
scott
Reply With Quote
  #2 (permalink)  
Old 05-02-11, 04:52
rski rski is offline
Registered User
 
Join Date: Nov 2006
Posts: 82
Use triggers.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On