select ts2_channels.s_channel_name as s_channel_name,
       ts2_channels.i_channel_parent_id as i_channel_parent_id,
       ts2_channel_privileges.i_cp_channel_id as i_cp_channel_id,
       ts2_channel_privileges.b_cp_flag_admin as b_cp_flag_admin,
       ts2_channel_privileges.b_cp_flag_autoop as b_cp_flag_autoop,
       ts2_channel_privileges.b_cp_flag_autovoice as b_cp_flag_autovoice
from ts2_channel_privileges,
     ts2_channels
where ts2_channel_privileges.i_cp_server_id = :iServerID
and ts2_channel_privileges.i_cp_client_id = :iClientID
and ts2_channels.i_channel_server_id = ts2_channel_privileges.i_cp_server_id
and ts2_channels.i_channel_id = ts2_channel_privileges.i_cp_channel_id
