AndyC1000
asked on
Query to sum over two fields
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
Thanks
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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Open in new window