Quantcast
Channel: Microsoft SQL Server
Viewing all articles
Browse latest Browse all 4871

Calculating a grand total involving two tables

$
0
0

Trying to figure out the best way to calculate a grand Total on an access form i am building. (Backend is mssql) I have a subform for the individual items. The PO number is the unique id for the main form and the sub form automatically pulls the PO number as a column in the subform. I tried creating a view, i was able to calculate the grand totals via that method, however the view as designed can't be used in the front end.

Would it be easier to create a calculated column in the original table for GrandTotal or easier on the form side? attached is the sql code i used for the view and a screenshot of the form.

Select (COALESCE(SUM(GLIA.Quantity * GLIA.Price), 0) + COALESCE(Max(b.Shipping), 0) + COALESCE(max(b.Tax ), 0)) as GrandTotal
, b.PO
, b.[Date]
,b.[ItemClass]
,b.[Dept]
,b.[Vendor]
,b.[ContactPhone]
,b.[Quote]
...


Viewing all articles
Browse latest Browse all 4871


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>