Results 1 to 2 of 2
  1. #1
    sandy16 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2015
    Posts
    1

    need help to match the sum of column values to another table

    Hi,



    I am using access 2010. I have "classlevel" table with 2 columns-Class and Value1 .Value1 column has numeric values that i ll input from webpage (webpage to ms access connectivity).

    I want to sum the values of column "Value1" and i have another table-"Volume" which has 2 columns "VolumeLevel" and "Value2". So i want to match the sum that i calculated from first table-"ClassLevel" with the "value2" column in "Volume" table and get the corresponding "volumelevel" column value from that table and there is a third table that will get this volumelevel value.

    There is no common column to join these tables.

    Classlevel-


    Class Value1
    Class 0 3000
    Class 1 2000
    Class 2 300
    Class 3 400
    Class 4 500




    Volume-


    Volumnlevel Value2
    Vo 0
    V1 5000
    V2 10000
    V3 30000
    ....upto V10




    Answer that i am looking for is V1 as sum=6200 lies between 5000 and 10000 so its V1.


    Table 3-


    Volume-
    V1




    Please help on how to do this.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    sorry, this is messy...

    Q1 will be:
    select sum([Value1]) as SumVol from Classlevel

    Q2 =
    SELECT Max(Volume.Value2) AS MaxOfValue2, [q1].[SumVal]>=[Value2] AS IsLessTotFROM Volume, q1
    GROUP BY [q1].[SumVal]>=[Value2]
    HAVING ((([q1].[SumVal]>=[Value2])=True));

    Q3=
    SELECT Min(Volume.Value2) AS MinOfValue2, [q1].[SumVal]<=[Value2] AS IsLessTot
    FROM Volume, q1
    GROUP BY [q1].[SumVal]<=[Value2]
    HAVING ((([q1].[SumVal]<=[Value2])=True));


    the ANSWER:
    Q4 =
    SELECT Volume_1.Volumnlevel, Q2.MaxOfValue2, Q1.SumVal, Q3.MinOfValue2, Volume.VolumnlevelFROM Q1, Q3 INNER JOIN Volume ON Q3.MinOfValue2 = Volume.Value2, Q2 INNER JOIN Volume AS Volume_1 ON Q2.MaxOfValue2 = Volume_1.Value2;

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 05-11-2014, 11:48 AM
  2. Replies: 4
    Last Post: 02-06-2014, 03:35 PM
  3. Find an Exact Match in a Access Table column
    By raghavendran in forum Access
    Replies: 4
    Last Post: 10-12-2013, 11:57 AM
  4. Replies: 8
    Last Post: 11-04-2011, 06:52 AM
  5. Replies: 0
    Last Post: 07-26-2011, 02:03 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums