Query Totals

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have the following query. I need to add more fields to this query, but
when I do they also have a "Group By" total. I want the fields that I
currently have in the query to be Grouped by and then I'd like to add more
fields that are not grouped because I want to see all of those records, not
group them. Is there a way to do this? Thank you

SELECT SASNoDemoutTwo.MODEL, SASNoDemoutTwo.TOPLEVEL, SASNoDemoutTwo.PARTA,
SASNoDemoutTwo.PARTB, SASNoDemoutTwo.PARTC, SASNoDemoutTwo.PARTD,
SASNoDemoutTwo.PARTE, SASNoDemoutTwo.PARTF, SASNoDemoutTwo.PARTG,
SASNoDemoutTwo.PARTH, SASNoDemoutTwo.PARTI, Max(SASNoDemoutTwo.NPIEC) AS
MaxOfNPIEC
FROM SASNoDemoutTwo
GROUP BY SASNoDemoutTwo.MODEL, SASNoDemoutTwo.TOPLEVEL,
SASNoDemoutTwo.PARTA, SASNoDemoutTwo.PARTB, SASNoDemoutTwo.PARTC,
SASNoDemoutTwo.PARTD, SASNoDemoutTwo.PARTE, SASNoDemoutTwo.PARTF,
SASNoDemoutTwo.PARTG, SASNoDemoutTwo.PARTH, SASNoDemoutTwo.PARTI
ORDER BY SASNoDemoutTwo.MODEL, SASNoDemoutTwo.TOPLEVEL,
SASNoDemoutTwo.PARTA, SASNoDemoutTwo.PARTB, SASNoDemoutTwo.PARTC,
SASNoDemoutTwo.PARTD, SASNoDemoutTwo.PARTE, SASNoDemoutTwo.PARTF,
SASNoDemoutTwo.PARTG, SASNoDemoutTwo.PARTH, SASNoDemoutTwo.PARTI;
 
Alex said:
I have the following query. I need to add more fields to this query, but
when I do they also have a "Group By" total. I want the fields that I
currently have in the query to be Grouped by and then I'd like to add more
fields that are not grouped because I want to see all of those records, not
group them. Is there a way to do this? Thank you

SELECT SASNoDemoutTwo.MODEL, SASNoDemoutTwo.TOPLEVEL, SASNoDemoutTwo.PARTA,
SASNoDemoutTwo.PARTB, SASNoDemoutTwo.PARTC, SASNoDemoutTwo.PARTD,
SASNoDemoutTwo.PARTE, SASNoDemoutTwo.PARTF, SASNoDemoutTwo.PARTG,
SASNoDemoutTwo.PARTH, SASNoDemoutTwo.PARTI, Max(SASNoDemoutTwo.NPIEC) AS
MaxOfNPIEC
FROM SASNoDemoutTwo
GROUP BY SASNoDemoutTwo.MODEL, SASNoDemoutTwo.TOPLEVEL,
SASNoDemoutTwo.PARTA, SASNoDemoutTwo.PARTB, SASNoDemoutTwo.PARTC,
SASNoDemoutTwo.PARTD, SASNoDemoutTwo.PARTE, SASNoDemoutTwo.PARTF,
SASNoDemoutTwo.PARTG, SASNoDemoutTwo.PARTH, SASNoDemoutTwo.PARTI
ORDER BY SASNoDemoutTwo.MODEL, SASNoDemoutTwo.TOPLEVEL,
SASNoDemoutTwo.PARTA, SASNoDemoutTwo.PARTB, SASNoDemoutTwo.PARTC,
SASNoDemoutTwo.PARTD, SASNoDemoutTwo.PARTE, SASNoDemoutTwo.PARTF,
SASNoDemoutTwo.PARTG, SASNoDemoutTwo.PARTH, SASNoDemoutTwo.PARTI;

You can't have ungrouped fields becuase you are using an aggregate function
(Max)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Set field value in record if MAX 0
Access Query problem 1
Simple Question on Addition 3
How do you remove a Group By from a query? 2
Adding totals in Query 2
Access Dcount (multiple criteria) 3
Group by query question 1
The not "Max" records 1

Back
Top