Results 1 to 2 of 2
  1. #1
    jscriptor09 is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Jul 2011
    Posts
    60

    subQuery for a total

    Hi

    I am trying to figure out how to SQL this situation

    I have a SQL statement that select from a Table, Groups product sold by [Store ID] while summing up products [Sold This Week].

    This works fine. So the fields are
    [Fiscal Week], [Store ID], Product, [Sold This Week]



    I need to add subQuery that so that using same Table, I want to Sum, in same row, for each Product [Total Sold] in each [Store ID] so that the final list of fields looks like this

    [Fiscal Week], [Store ID] as theStore, Product, [Sold This Week] , [Total Sold]

    if I try to set up the Query "Pseudo" like this

    [Fiscal Week], [Store ID] as theStore, Product, [Sold This Week] , (Select from Table sum([Sold]) where [Store ID]=theStore ) as [Total Sold]

    it keeps prompting for theStore .

    Question:
    Is there a way to pass theStore as a parameter to the sub query?

    If there is an example somewhere on the web, I would appreciate a pointed and even a example query for a similar situation.

    thanks for the help.

    Mike

  2. #2
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,441
    I don't understand your question, can you give an example of your starting data and what you want the end result to be.

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

Similar Threads

  1. Subquery
    By Daryl2106 in forum Access
    Replies: 20
    Last Post: 01-13-2013, 07:21 AM
  2. Subquery
    By tomclavil in forum Queries
    Replies: 3
    Last Post: 02-27-2012, 03:05 AM
  3. Subquery for total
    By Fabdav in forum Queries
    Replies: 8
    Last Post: 01-21-2012, 04:17 PM
  4. TOP subquery
    By helpaccess in forum Queries
    Replies: 5
    Last Post: 08-30-2011, 10:28 AM
  5. Subquery
    By combine21 in forum Queries
    Replies: 2
    Last Post: 09-17-2010, 04:33 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