Results 1 to 9 of 9
  1. #1
    markpastoril is offline Advanced Beginner
    Windows 10 Access 2013 64bit
    Join Date
    Aug 2018
    Posts
    62

    multi-level group by clause is not allowed in a subquery how to solve?please help.

    actual image:


    Click image for larger version. 

Name:	sum and totals  wont show on report..jpg 
Views:	26 
Size:	77.4 KB 
ID:	35549
    Click image for larger version. 

Name:	subquery.jpg 
Views:	25 
Size:	109.8 KB 
ID:	35550 I just want to show the total/ sum of my report.
    thanks in advance.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Post the SQL statement.

    What is the expression for Balance?

    Why don't you use aggregate function in textbox?

    Use the Balance expression in Sum() function.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    markpastoril is offline Advanced Beginner
    Windows 10 Access 2013 64bit
    Join Date
    Aug 2018
    Posts
    62
    this is the Expression in Balance[AMOUNTDUE])+([MATERIALS/OTHERS])-([AMOUNTPAID])
    sorry did'nt include the BALANCE field in screenshot.

    using Sum() was the 1st thing that I use, and then the pop up error:multi-level group by clause is not allowed in a subquery

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    You haven't posted the SQL statement. Why are you using a subquery?

    =Sum([AMOUNTDUE]+[MATERIALS/OTHERS]-[AMOUNTPAID])
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    markpastoril is offline Advanced Beginner
    Windows 10 Access 2013 64bit
    Join Date
    Aug 2018
    Posts
    62
    I've used the subquery to automatically get the last reading/record from the last reading. So the user only enters the current reading value,and subtract it with the last reading/record then it calculates the consumption within a month.

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Well, can't help if you won't provide the SQL statement. Some sample data would be helpful also. If you want to provide db for analysis, follow instructions at bottom of my post.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    markpastoril is offline Advanced Beginner
    Windows 10 Access 2013 64bit
    Join Date
    Aug 2018
    Posts
    62
    This the sql

    SELECT Transactions.Month, Transactions.CustomersID, Transactions.DATEBILLED, (SELECT METERREADING FROM Transactions AS Alias WHERE DATEBILLED = (SELECT Max(DATEBILLED) FROM Transactions AS Alias2 WHERE Alias2.DATEBILLED < Transactions.DATEBILLED AND Alias2.CustomersID = Transactions.CustomersID) AND Alias.CustomersID = Transactions.CustomersID) AS PrevEnd, Transactions.METERREADING, [METERREADING]-[PrevEnd] AS Consumption, Transactions.[MATERIALS/OTHERS], Transactions.[AMOUNT PAID], Transactions.[DATE PAID], Transactions.[OR #]
    FROM Transactions;

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    You need meter reading from another record? This is exactly the example used in tutorial by Allen Browne. Review http://allenbrowne.com/subquery-01.html#AnotherRecord
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  9. #9
    markpastoril is offline Advanced Beginner
    Windows 10 Access 2013 64bit
    Join Date
    Aug 2018
    Posts
    62
    I've already solve the problem, I've created another query w/c contains only the customersID and the previous reading and then connected the 2 queries to create another one so the subquery from previous reading data becomes a read only and that way it allows me to group and sum.
    by the way thanks for the help. JUNE7

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

Similar Threads

  1. sql subquery alias join from clause error
    By rwhite7 in forum Access
    Replies: 1
    Last Post: 12-16-2014, 02:06 PM
  2. Replies: 1
    Last Post: 07-23-2014, 04:44 PM
  3. SELECT & GROUP BY Clause
    By johnseito in forum Access
    Replies: 5
    Last Post: 07-11-2014, 10:55 PM
  4. generate multi-level csv
    By shank in forum Queries
    Replies: 5
    Last Post: 09-16-2010, 04:25 AM
  5. Multi Level Form
    By bkelly in forum Access
    Replies: 2
    Last Post: 08-28-2009, 11:15 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