postgresql7.3 select eg.grade_plural_name, eg.grade_id, eg.grade_item_id from evaluation_gradesx eg, acs_objects ao where content_revision__is_live(eg.grade_id) = true and eg.item_id = ao.object_id and ao.context_id in ([join $list_of_package_ids ,]) order by grade_plural_name desc select evaluation__class_total_grade(:user_id,[lindex $list_of_package_ids 0])