Query Help

G

Guest

I have the following query and i need to only have files that have aggregate
totals >=5000. If someone could please assist that would be great. Thank
you.


SELECT [03/12-19/01 by date].SSN, Sum(qrySarsAggregateTotal.Aggregate) AS
SumOfAggregate
FROM [03/12-19/01 by date] INNER JOIN qrySarsAggregateTotal ON [03/12-19/01
by date].ID = qrySarsAggregateTotal.ID
GROUP BY [03/12-19/01 by date].SSN
HAVING (((Sum(qrySarsAggregateTotal.Aggregate))>="5000"))
ORDER BY [03/12-19/01 by date].SSN;
 
G

Guest

"5000" shouldn't have quotation marks around it. It's a number; not text.

If that doesn't work, try this:

SELECT SSN, SumOfAggregate
FROM (SELECT [03/12-19/01 by date].SSN,
Sum(qrySarsAggregateTotal.Aggregate) AS SumOfAggregate
FROM [03/12-19/01 by date]
INNER JOIN qrySarsAggregateTotal
ON [03/12-19/01 by date].ID = qrySarsAggregateTotal.ID
GROUP BY [03/12-19/01 by date].SSN )
WHERE SumOfAggregate >= 5000
ORDER BY SSN;
 

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

Top