postgresql7.1 select site_node__url(min(node_id)) from site_nodes where object_id = (select package_id from cal_items ci, calendars where cal_item_id = :object_id and ci.on_which_calendar = calendars.calendar_id) select site_node__url(min(node_id)) from site_nodes where object_id = (select package_id from calendars where calendar_id = :object_id)