aggregate Sum

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • creative1
    Contributor
    • Sep 2007
    • 274

    aggregate Sum

    hi
    Can someone help me writing this query. I been trying since last night no success.
    strSQL = "SELECT Group_codes.Gro up_ID, Group_codes.Nam e, SUM(inv_detail. price * inv_detail.quan tity) AS price1 FROM product_codes, catagory_codes, inv_detail, inv_total, Group_codes WHERE group_codes.gro up_id = catagory_codes. group_id AND product_codes.c at_code = catagory_codes. cat_code AND product_codes.I tem_code = inv_detail.item _code AND inv_detail.tran _id = inv_total.tran_ id and inv_total.date between #" & strTo & "# and #" & strFrom & "#GROUP BY Group_codes.Gro up_ID, Group_codes.Nam e"

    I have four group codes I want to get nettotals of all purchases against these code. I am using above written query.

    this gives me following out put
    Group ID Name Price(i.e sum of all item which belong to one group catagory)
    1 **** total of item having group id 1
    2 *** for grp code 2
    3 *** for grp code 3
    4
    datareport look good and isplays correct information. How I can get GRANDTOTAL(grp 1 2 3 and 4)
  • QVeen72
    Recognized Expert Top Contributor
    • Oct 2006
    • 1445

    #2
    Hi,

    Place a TextBox in Footer Section of DataReport.
    From VB6 , Before Showing the Report, Get the Total, (open Recordset )
    and pass that to the DataReport

    Regards
    Veena

    Comment

    • vannakae

      #3
      open the properties of command1 and go to the aggregates tab and set the combo selection of your choice

      Comment

      Working...