postgresql7.3
select eg.grade_plural_name,
eg.grade_id,
eg.grade_item_id
from evaluation_gradesx eg, acs_objects ao
where (select count(*) from cr_items
where live_revision = eg.grade_id) > 0
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])