SELECT id_card, id_card_type, c.id_card_company, cc.name, value FROM bell.card c inner join bell.card_company cc using(id_card_company) where cc.active='y' and (active_nn>reserve_nn or id_card_type>2) and value>4 order by cc.name, value