select
man_id
from
ims_cp_organizations
where
org_id = :org_id
select
sort_order
from
ims_cp_items
where
ims_item_id = :ims_item_id
select
ims_item_id, sort_order
from
ims_cp_items
where
parent_item = :parent_item
order by sort_order asc
select
parent_item
from
ims_cp_items
where
ims_item_id = :ims_item_id
select
ims_item_id
from
ims_cp_items
where
parent_item = ( select
parent_item
from
ims_cp_items
where
ims_item_id = :parent_item )
order by sort_order asc
select
ims_item_id, sort_order
from
ims_cp_items
where
sort_order > :item_sort and sort_order < :next_sort
and org_id = :org_id
order by sort_order
select
sort_order
from
ims_cp_items
where
ims_item_id = :next_item
and org_id = :org_id
order by sort_order
select
max(sort_order)
from
ims_cp_items
where
org_id = :org_id
select
ims_item_id, sort_order
from
ims_cp_items
where
sort_order < :item_sort and sort_order > :back_sort
and org_id = :org_id
order by sort_order
select
ims_item_id, sort_order
from
ims_cp_items
where
sort_order > :item_sort and sort_order < :next_sort
and org_id = :org_id
order by sort_order
select
ims_item_id, sort_order
from
ims_cp_items
where
sort_order > :next_sort and sort_order < :back_sort
and org_id = :org_id
order by sort_order