select row_number() over (ORDER BY year.VALUE_ DESC, papers.object_name) as row , papers.object_id as OBJECTID,papers.object_name as PAPERNAME, paperusage.object_name as USAGE, year.value_
from objects papers inner join eav_objects statedusage on papers.object_id=statedusage.object_id and papers.object_class=42 inner join objects paperusage on paperusage.object_id=statedusage.value_ and statedusage.attribute_id=452 left join eav_string year on year.OBJECT_ID = papers.OBJECT_ID and year.ATTRIBUTE_ID = 154
ORDER BY year.VALUE_ DESC, papers.object_name
|