# заполняем отсутсвующие записи в camp_options
#
# база: PPC
# выполняется около 15 сек.
# выполянть лучше во время минимальной нагрузки

insert ignore into camp_options (cid, email, FIO)
select STRAIGHT_JOIN c.cid, u.email, u.FIO
from campaigns c
     left join camp_options co on co.cid = c.cid
     join users u on u.uid = c.uid
where u.email != ''
  and c.statusEmpty = 'No'
  and co.cid is null;
