Results 1 to 2 of 2
  1. #1
    maddysanoo is offline Novice
    Windows Vista Access 2007
    Join Date
    Jun 2010
    Posts
    1

    Require Urgent Help Regarding UNION and SUM

    Hello Everyone,
    Hope you all are doing good?
    Here is the scenario:

    1. Table Structure: Have 3 tables:
    JAN2010
    FEB2010
    MAR2010

    All of the tables have the following fields:
    CIS
    Segments
    NET_PROFITABILITY

    Following is the data:

    JAN2010
    CIS Segments NET_PROFITABILITY
    1005145 Extended 34
    3245677 EEU 33
    45454 Basic 22

    FEB2010
    CIS Segments NET_PROFITABILITY


    45454 Basic 12
    3245677 EEU 3
    1005145 Extended 4

    FEB2010
    CIS Segments NET_PROFITABILITY
    3245677 EEU 3
    45454 Basic 2
    1005145 Extended 5


    2. What needs to be done:

    What i need to do is to have NET_PROFITABLITY added for all te three months and have respective Segments displayed along with their CIS.

    Please let me know about this. Need your help. I know it will be done using UNION AND SUM but not sure how.

    Please please please let me know.

    Regards,

    Maddy

  2. #2
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    For starters, you realize that's a big design flaw? The UNION query will simply be used to get the data into the format it should have been in in the first place.

    SELECT CIS, Segments, NET_PROFITABILITY, "201001" AS Period
    FROM Jan2010
    UNION ALL
    SELECT CIS, Segments, NET_PROFITABILITY, "201002" AS Period
    FROM Feb2010
    ...

    Then a totals query against that.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Help Require (Macro Save button )?????
    By aligahk06 in forum Access
    Replies: 1
    Last Post: 04-18-2010, 08:38 AM
  2. union query with a calculated field
    By grad2009 in forum Queries
    Replies: 9
    Last Post: 03-31-2010, 04:50 PM
  3. UNION two tables with same primary key values
    By carillonator in forum Queries
    Replies: 1
    Last Post: 02-02-2010, 08:54 PM
  4. Need help with a Union Query
    By jdowdy in forum Access
    Replies: 1
    Last Post: 10-13-2009, 05:24 PM
  5. require help with query
    By ashiers in forum Queries
    Replies: 2
    Last Post: 04-15-2009, 08:04 AM

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