Notice
Recent Posts
Recent Comments
- Today
- Total
내 머릿속 데이터베이스
[MySQL] 년월일 추이 통계 구할때 유용함 본문
특정 기간에 대해 품별 합계를 구할 때
SELECT
stock_idx,
product_name,
color_number,
color_name,
SUM(len) AS sum_len,
order_date
FROM
sales_item_view
WHERE
order_date > '2015-04-06'
AND order_date < '2015-04-07'
GROUP BY order_date
ORDER BY sum_len DESC;
3월에 해당되는 판매량의 합계를 각 일마다 보여줘라.
SELECT
SUM(len) AS sum_len,
EXTRACT(DAY FROM order_date) as whatDAY,
order_date
FROM
sales_item_view
WHERE
order_date like '2015-03-%'
GROUP BY whatDAY
ORDER BY whatDAY;
Comments