是否可以在多个选择中使用AS? 类似的东西:
SELECT O.order_id, Sum(Order_Tot) FROM
(SELECT P.price * O.qty as Order_Tot FROM crOrdersToProducts O
JOIN tblProducts P ON O.style_id = P.id)
GROUP BY O.order_id
尝试使用一个查询按订单ID显示订单总计。
答案 0 :(得分:0)
//try this query
SELECT OT.order_id, Sum(OT.Order_Tot) FROM
(SELECT O.order_id,P.price * O.qty as Order_Tot FROM crOrdersToProducts O
JOIN tblProducts P ON O.style_id = P.id) as OT
GROUP BY OT.order_id