postgresql7.1
select site_node__url(min(node_id))
from site_nodes
where object_id = (select package_id
from forums_forums
where forums_forums.forum_id = :forum_id)
select site_node__url(min(node_id))
from site_nodes
where object_id = (select package_id
from forums_forums
where forums_forums.forum_id = :forum_id)
select subject, content, format
from forums_messages
where message_id=:message_id or (tree_sortkey between tree_left(:tree_sortkey) and tree_right(:tree_sortkey))
and forum_id=:forum_id
order by tree_sortkey