Q3 날짜별 매출합계 출력 숙제 부분에서
id 컬럼, 구매날짜, 일별합계 컬럼 3개가 출력되는데 id는 어떻게 출력해요?
select
sales.id, 구매날짜, sum(가격) as 일별합계
from sales inner join product
on sales.상품id = product.id
inner join user_table
on sales.고객번호 = user_table.id
group by sales.구매날짜
order by 구매날짜;
이렇게 하니 시도하니
[42000][1055] Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'hmoework1.sales.id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
이런 오류가 나와서..
SELECT
sales.id, sales.구매날짜, SUM(product.가격) AS 일별합계
FROM sales
INNER JOIN product
ON sales.상품id = product.id
INNER JOIN user_table
ON sales.고객번호 = user_table.id
GROUP BY sales.id, sales.구매날짜;
이렇게 하니 결과값이 이상하구요.. 어떻게 쿼리를 짜야하죠??