Fixed sql query on all assignments page