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 ;
