Discussion Locked

sql for summing data in fields

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

want to find the sum of two fields in an access database linked to a visual basic datagrid.
the sum is performed on a previous search say volume,weight of some goods imported by a particular individual.

5 replies

by glen_mcleod

Change the grid's recordsource from the table to a query.

Select a, b, c, d, (Volume * Weight) as e
From TourTableNameHere
Where .....

Save the query in the DB and set the grid's recordsource to the query.

Glen

by churdoo

SELECT importedBy, Sum(volume) AS sumVol, Sum(weight) AS sumWt
FROM myTable
GROUP BY importedBy
HAVING (importedBy='thatguy')

will return a result record containing the sum of the volume and weight of all goods imported by 'thatguy'

--Charlie

This discussion is closed to new replies.