Results 1 to 6 of 6
  1. #1
    brainiack18 is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Jul 2011
    Posts
    3

    SQL Sum+GROUP BY problem

    Hi All,


    First off, thank you for taking the time to help me. Here is my dilemma:

    Assuming all the column and table names and spelled correctly, is there any reason why this bit of SQL code isn't working?

    SELECT [SalesQty/Year].JPEPN
    SUM ([SalesQty/Year].QuantityShipped)
    FROM [SalesQty/Year]
    GROUP BY [SalesQty/Year].JPEPN;

    Thank you!

  2. #2
    brainiack18 is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Jul 2011
    Posts
    3
    The error message says something like "Syntax error (Missing Operator)" I have double and triple checked that I spelled everything correctly.

  3. #3
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Define "isn't working". I'd alias the field:

    SELECT [SalesQty/Year].JPEPN
    SUM ([SalesQty/Year].QuantityShipped) AS TotalShipped
    FROM [SalesQty/Year]
    GROUP BY [SalesQty/Year].JPEPN;
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Sorry, missed this. You need a comma between the fields:

    SELECT [SalesQty/Year].JPEPN,
    SUM ([SalesQty/Year].QuantityShipped) AS TotalShipped
    FROM [SalesQty/Year]
    GROUP BY [SalesQty/Year].JPEPN;
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    brainiack18 is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Jul 2011
    Posts
    3
    Thank you, can't believe I missed the comma -_-

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    No problem. It's always the little things the trip us up.
    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. query group by over another group by?
    By gap in forum Queries
    Replies: 2
    Last Post: 07-04-2011, 12:59 AM
  2. Replies: 5
    Last Post: 11-29-2010, 08:16 AM
  3. Dependent option group problem
    By Remster in forum Programming
    Replies: 5
    Last Post: 10-22-2010, 10:23 AM
  4. Group by
    By EstesExpress in forum Queries
    Replies: 0
    Last Post: 02-26-2010, 07:52 AM
  5. columns for group detail but not group header?
    By Coolpapabell in forum Reports
    Replies: 0
    Last Post: 08-21-2009, 08:53 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