postgresql7.1
select ims_item_id as imsitem_id, coalesce(acs_object__name(object_id),'Item '||object_id) as last_page_viewed
from views_views v, ims_cp_items i, ims_cp_organizations o
where v.viewer_id = :user_id
and v.object_id = i.ims_item_id
and i.org_id = o.org_id
and o.man_id = :man_id
order by v.last_viewed desc
limit 1