Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE PROCEDURE [dbo].[dashboard_tst-dashboard_progressProducts_getPanelTable]
- @username nvarchar(128)
- AS
- BEGIN
- declare @maxProduct int
- select top 1 @maxProduct = (select sum(cnt) from tst_orders where productID = tst_products.id)
- from tst_products
- order by (select sum(cnt) from tst_orders where productID = tst_products.id) desc
- select name Title,
- @maxProduct / 100 * (select sum(cnt) from tst_orders where productID = tst_products.id) Value
- from tst_products
- where (select sum(cnt) from tst_orders where productID = tst_products.id) > 0
- END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement