Skip to content

Instantly share code, notes, and snippets.

@doryokujin
Created May 26, 2015 04:20
Show Gist options
  • Save doryokujin/f4409ce8130bc2545d55 to your computer and use it in GitHub Desktop.
Save doryokujin/f4409ce8130bc2545d55 to your computer and use it in GitHub Desktop.
SELECT
sub_category, category,
COUNT(1) AS record_number,
SUM(amount) total_amount,
SUM(amount * price) AS total_sales
FROM sales_slip_10k
GROUP BY category, sub_category
ORDER BY category, sub_category
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment