Removed sha code from the query to fix duplicated ccgs. Removed closed practices. Added functions to calculate avg, min and max, total annual spend, spend in difference. Prescription data is now pulled by code.