How to display sum of total order sales per product and product related information. Sql Server 2014

Based on your table structure I have come to this solution.

select p.product_name, c.category_name, sum(o.quantity * o.list_price * as total_sale_per_product
from sales.order_items o
    inner join production.products p on o.product_id = p.product_id
inner join production.categories c on p.category_id = c.category_id
group by p.product_name, c.category_name order by total_sale_per_product desc
offset 0 rows fetch next 10 rows only;

Assuming that you are developing web application pass the the offset rows and fetch rows through url [query string is better option].

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top