
synopsis:

    Activation-keys and their associated config channels

description:

    Lists all activation-keys and any config-channels they apply, along with ordering

columns:

        org_id       The organization that owns the key
        token        The actual token for this key
        channel_pos  "cfg-channel-label | position" for each cfg-channel in this key

multival_columns:

        token
        channel_pos : channel_pos

sql:

    select * from (
      select rt.org_id,
             ak.token, 
             rc.label || '|' || rtc.position channel_pos
      from rhnactivationkey ak
           inner join rhnregtoken rt ON rt.id = ak.reg_token_id
           left outer join rhnregtokenconfigchannels rtc on rtc.token_id = rt.id
           left outer join rhnconfigchannel rc on rc.id = rtc.config_channel_id
    ) X
    -- where placeholder
    order by org_id, token, channel_pos

