select cust_name,
(
select order_num FROM Orders AS b
WHERE b.cust_id = a.cust_id
) order_num
FROM Customers AS a
ORDER BY cust_name,order_num
select cust_name, order_num FROM Customers AS ct JOIN Orders AS od ON ct.cust_id = od.cust_id ORDER BY cust_name,order_num

京公网安备 11010502036488号