Get query ready for report