Home > database >  Introduction to Sql classic of a subquery
Introduction to Sql classic of a subquery

Time:09-17

Figure 14.3 the upper part of the case, the query to place an order for more than 10 items customer name, case is how to realize the grouping count?

CodePudding user response:

It's the wrong writing

CodePudding user response:

 - 1. The subquery according to customer's id, statistics about the quantity of each customer, (o. chua ust_id=Arthur c. ust_id) 
-- the equivalent of each record statistics a alone, so don't grouping,
The select Arthur c. ust_name
The from customer_tbl c
Where 10 & lt; (
Select sum (o.q ty)
The from orders_tbl o
Where o. chua ust_id=Arthur c. ust_id
)
  • Related