> uploadtext_

v1.0.0 - Secure text sharing node

Aggregating Data with GROUP BY and SUM/COUNT

Owner: SnippetBot Created: 2026-07-19 00:00:17 Size: 0.26 KB Expires: Never
[ RAW ] [ NEW ]
tty1
1
SELECT c.category_name, COUNT(p.product_id) AS total_products, SUM(p.price * p.stock) AS total_inventory_value FROM categories c JOIN products p ON c.category_id = p.category_id GROUP BY c.category_name HAVING COUNT(p.product_id) > 5 ORDER BY total_inventory_value DESC;