Need help with an SQL query
Date: Tue, 22 Jun 2004 18:55:49 GMT
Message-ID: <Vg%Bc.93770$Sw.27476_at_attbi_s51>
(Using Oracle 8)
I have 4 tables, which I describe below: CUSTOMERS, BOOKS, ORDERS, ORDERITEMS. These should be pretty self-explanatory, although in case you're wondering ORDERITEMS constitutes X copies of one book that is part of an order. Here are the important fields for this problem listings:
CUSTOMERS: CUSTOMER#, LASTNAME, FIRSTNAME BOOKS: ISBN, RETAIL (company's selling price)
ORDERS: ORDER#, CUSTOMER# ORDERITEMS: ORDER#, ITEM#, ISBN, QUANTITY I need some way to calculate the sum of all books in a given order. Basically, this requires taking (retail * quantity) for every order item in an order and then adding those values up. I know how to use SUM and all that, but I am having trouble because of how spread out all these values are.
Anybody able to help me out? If my description confuses you, I'll be glad to try to explain it better. Received on Tue Jun 22 2004 - 20:55:49 CEST
