It is extremely unlikely that you actually need to do this. Making temp tables rather than binding a form/report to a query just bloats the database.
If you want to sort the data by priority and that priority is defined by defect, then add priority to the defect definition table. Left join to this table to pull in priority. Chang your sort (using sorting and grouping options NOT your query) to sort first by priority and second by count of defects. You want the two field sort so that items with the same priority or "no" priority will still sort by count.
To give yourself some flexibility, number the priority by 100's to allow gaps for you to adjust the sequence without having to renumber the entire list. Make the default,9999 or something higher than the higlest actual value. You will have to run an update query first to set the 9999 values before you set the field to required and update the default value. Then change whichever defects you want to assign priority's to.