+ Reply to Thread
Results 1 to 4 of 4

access SQL to pull all fields in a table and group them based on their ID

  1. #1
    Registered User
    Join Date
    08-31-2012
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    87

    access SQL to pull all fields in a table and group them based on their ID

    I have this table with these fields:

    Employee ID
    sum of expenses aug-12
    sum of expenses sep-12
    sum of expenses oct-12
    .
    ..
    ...
    Up until the last field that would always be named "total of sum expenses".


    One employee ID could have multiple "sum of expenses aug-12", etc..

    I would like to create a query that group all of the fields based on Employee ID and sum all of the "sum of expenses" fields..

    The fields names could vary month to month, thus I want to create a SQL statement that pull all of the "sum of expenses" fields regardless of the names of the fields...

    Thanks!
    Last edited by ewong; 12-26-2012 at 01:33 PM.

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643
    Is this table based on another table?
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    08-31-2012
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    87

    Re: access SQL to pull all fields in a table and group them based on their ID

    No, it's not based on another table

    Quote Originally Posted by Norie View Post
    Is this table based on another table?

  4. #4
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,873

    Re: access SQL to pull all fields in a table and group them based on their ID

    Your tables are not normalized.

    Look at this white paper on design.

    http://www.deeptraining.com/litwin/d...aseDesign.aspx
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1