SELECT TRUNCATE(PRICE, -4) AS PRICE_GROUP,
COUNT(PRICE) AS PRODUCTS
FROM PRODUCT
GROUP BY PRICE_GROUP
ORDER BY PRICE_GROUP
조건대로 나눠서 갯수를 가져오게 하는 것이다.
SELECT TRUNCATE(PRICE/10000)*10000 AS PRICE_GROUP,
COUNT(PRICE) AS PRODUCTS
FROM PRODUCT
GROUP BY TRUNCATE(PRICE/10000)*10000
ORDER BY PRICE_GROUP