postgresql7.1
select
bookmark_id, local_title
from
bm_bookmarks
where
tree_sortkey like
(
select tree_sortkey || '%'
from bm_bookmarks
where bookmark_id = :root_folder_id
)
order by tree_sortkey
and
acs_permission__permission_p(bookmark_id, acs__magic_object_id('registered_users'), 'read') <> :public_p