troubleshooting Question

Query to sum over two fields

Avatar of AndyC1000
AndyC1000 asked on
Microsoft Access
2 Comments1 Solution509 ViewsLast Modified:
Dear all,

I'm not sure how to create query to sum over two fields.  If the dist_no and i_datatime is the same sum the fields total_dollar_loss, total_ha and appliance_count.

i.e. instead of

02  2002/01/02  0  2  3
02  2002/01/02  1  0  5

the output should produce:

02  2002/01/02  1  2  8


 
SELECT s.dist_no, Format(s.i_datetime,"yyyy/mm/dd") AS Period, Sum(s.total_dollar_loss) AS TotDollarLoss, Sum(s.total_ha) AS TotHectare, Sum(s.appliance_count) AS TotAppCount INTO DailyTotalTable
FROM DataResults AS s
GROUP BY s.dist_no, Format(s.i_datetime,"yyyy/mm/dd");

Thanks
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 2 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros