[3.8.6] Fix report sql queries for downloads