Count taking reference of two field values

  • Thread starter Thread starter kamle_b
  • Start date Start date
K

kamle_b

Guest
Can anyone help?

I have few of these columns in my query

Code:
Loc      Company       Pack     RoundedNum       SumTotal
2           ASDA           AA             1 
2           ASDA           AA             5                 6
1          Asda             AC             2                 2
1          ABC              BB             10
1          ABC              BB              1               11
2          XYZ              AR              1                1


I am trying to achieve "SumTotal" column result. In the above query RoundedNum is an expression achieved from other columns(not shown above) from the same querytable. Now I want to insert this "SumTotal" column which will count for Total RoundedNum as per same type of Packs.

Thus the Total Field should look like the one shown above. Any idea how can i achieve this? :confused:

Thank you in advance.
 
SELECT Company, Pack, SUM(RoundedNum) AS SumTotal From table GROUP BY Company
 
Count/Sum, taking reference of two fields in Query

Dear Workmad3

Thank you for your reply.

I am not getting the result what i want. The query you told me just totals the packs.

I will explain my question again:
I want the result in SumTotal as, it will first look in Pack column, then look in RoundedNum column and enter the value in SumTotal.

So for eg: If column Pack has values AA, AA, BB, BB, BC, AR, BC, BC
and column RoundedNum values are 1, 3, 1, 1, 4, 2, 2, 4
Thus the SumTotal column should look like: [NIL], 4, [NIL], 2, 4, 2, [NIL],6

Therefore SumTotal watches the similar pack types in Pack Column and then looks for its next column RoundedNum for how many of these boxes are there, and gives me total in SumTotal of similar boxes using the numbers provided in RoundedNum

Hope this clarifies what i want to do, if not feel free to ask any questions.

Thank you
 

Users who are viewing this thread

Back
Top Bottom