Home > database > Looking for a great god, and mysql orders and goods list query problem, an order contains more than
Looking for a great god, and mysql orders and goods list query problem, an order contains more than
Time:09-17
As title, order table order (phone), order goods form the detail (order_id, goods_id, price_sell, amount), Now according to the order table some of the fields and the detail list of fields query order information, If only according to the detail list of goods_id query so DISTINCT,
The question now is, I want real goods_id=1 the subtotal amount of (amount * price_sell) are also displayed,
Did not for a long time,
CodePudding user response:
The easiest way to write two SELECT, a detailed, a subtotal, then UNION ALL together,