Last active
August 29, 2015 14:21
-
-
Save doryokujin/f9b71bff6d32271ca132 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
goods_id, sub_category, category, | |
COUNT(1) OVER (PARTITION BY category) AS record_number, | |
SUM(amount) OVER (PARTITION BY category) AS total_amount, | |
SUM(price*amount) OVER (PARTITION BY category) AS total_sales | |
FROM sales_slip_10k | |
ORDER BY goods_id, sub_category, category | |
LIMIT 10 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment