Here are some tutorials for you regarding query.
However, as I said, beware of the recalculation, which can resends for all rows and I would advise you to take some tests with dummy data first.