View: dbo.AR_Transaction_Item_Rollup_View | |||
View definition | |||
-- A grouping of AR transactions with the same GL transaction to total cost and amount. -- Note this view is indexed. CREATE VIEW dbo.AR_Transaction_Item_Rollup_View WITH SCHEMABINDING AS SELECT gl_transaction_KEY , sum(ISNULL(amount_override, amount_original) + additional_tax_amount) AS tax_adjusted_amount -- decimal(38,2) cast back to decimal(17,2) , sum(cost_amount) AS cost_amount -- in views that use it. -- rollup_count is required because this view involves a GROUP BY. Sql Server -- uses the information to optimize maintenance of the index. , COUNT_BIG(*) AS rollup_count FROM dbo.AR_Transaction_Item GROUP BY gl_transaction_KEY | |||