MySQL Forums
Forum List  »  General

Select Help
Posted by: Michael Lewis
Date: November 24, 2004 04:51PM

I'm creating a backend order management and display tool for a client and I have a question regarding the best way to implement it. The current table structure is an orders table containing order_id, order_datetime, billing_name, shipping_cost, etc. A second table called order_products contains order_id, product_id, quantity, and price. What I want to know is, is it possible to use one select statement to get the order info, which would include the fields from the orders tables AND a sum of the products (quantity * price) of the order_products table? I could always store the total order value in a field in the orders table, but it's completely redundant as I should be able to figure it out on the fly when I need it from the order_products table. I just don't know the proper syntax to use to do this. Please help, it will be greatly appreciated.

Michael Lewis

Options: ReplyQuote


Subject
Written By
Posted
Select Help
November 24, 2004 04:51PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.