How to export the number of sold products in a period?

Hi,

We need to export the total count by product sold through a period (really invoiced, not only on Sales because sometimes invoices are changed after the sale is complete).
It seems that the column named “#” in the Sales > Reporting > Sales then by product represents the number of sales containing one or more products, but it’s not the sum(quantity).

Similarly we need to export the total count by product from or to a stock location through a period. Should we use a direct SQL query on the db?