이 질문을 이해하려면 예제 데이터가 필요하지 않습니다. 나는 다음과 같이 각 고객과 관련된 사업을 결정하기 위해 쿼리를 쓰고 있어요 :쿼리의 그룹 별 원인에 대한 오해의 소지가 있습니다.
select
customers.cust_id,
sum(OrderItems.Quantity * OrderItems.Item_Price) as total_business
from
Customers
left outer join
Orders on Customers.cust_id = orders.cust_id
left outer join
OrderItems on orders.order_num = orderitems.order_num
-- group by Customers.cust_id -- why do I need this if I'm just trying to access the cust_id column?
order by total_business
나는 group by
절을해야하는 이유 난 그냥 cust_id
열을 액세스하기 위해 노력하고있어 만약 내가, 이해가 안 돼요. 나는 (select
) 새 테이블에 속하는 모든 열에 액세스 할 수있는 인상을 받고있었습니다.
+1은 훌륭한 설명이지만, 감자가 실제로 야채인지 알아 내려고하면서 3 분을 낭비하게 만들었 기 때문에 지금 재고하고 있습니다. :) – AHiggins