MySQL Forums
Forum List  »  Newbie

Re: Need help on query which show total sum of result incorrect
Posted by: Peter Brawley
Date: November 28, 2017 11:01PM

The query looks baroque yet seems also to be missing some basic elements of shopping order processing. Unfortunately your description of the requirement confuses me further.

What I can glean from what you write is that you have cart_items which link to purchase_orders on id_cart and to products on id_product, and you want a sum of what the user has in her cart.

The missing elements are prices (surely you want more than a count of items bought---don't you want qty*price for each item, and the sum?) and inventory checks (otherwise how do you ensure you can fill the order?). Nor do I understand how the orders table already has a row linking to the customer's cart ID. Nor do I understand why the orders table is called purchase_orders, which are usually not generated from shopping carts.

So we need a clearer account of what's needed, and let's see the result of Show Create Table for cart_items, products and purchase_orders tables.

Options: ReplyQuote


Subject
Written By
Posted
Re: Need help on query which show total sum of result incorrect
November 28, 2017 11:01PM


Sorry, only registered users may post in this forum.

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.