LanBilling
Выборка абонентов КТВ не имеющих услуги Интернет:
select accounts.mobile from agreements inner join accounts on accounts.uid=agreements.uid where length(accounts.mobile)=10 and agrm_id in (select agrm_id from vgroups where tar_id=472 and blocked<>10 and uid not in (select uid foups where id=1 and blocked<>10 and uid in (select uid from vgroups where tar_id=472 and blocked<>10)));
Восстановление «удаленного» договора:
1 2 3 4 5 6 |
update agreements_ext set closed_on=null where agrm_id=3922; update agreements set state=0 where agrm_id=3922; update accounts set archive=0 where uid=3760; update vgroups set archive=0 where agrm_id=3922; update agreements set archive=0 where agrm_id=3922; update vgroups set changed=0 where agrm_id=1628; |
Выборка по колхозу:
1 |
where uid in (select uid from usergroups_staff where group_id=1) |
Пользователи с не полными паспортными данными:
1 |
select agreements.number,accounts.name from accounts inner join agreements on agreements.uid=accounts.uid inner join vgroups on vgroups.agrm_id=agreements.agrm_id where vgroups.blocked<>10 and (accounts.pass_no="" or accounts.pass_sernum="" or accounts.abonent_surname="" or accounts.abonent_name="") and accounts.archive=0 and accounts.type=2 and agreements.archive=0 and accounts.uid in (select uid from usergroups_staff where group_id=5) group by agreements.number; |
Обновление в «фоне»:
(можно использовать если во время обновления выкидывает из консоли)
1 |
nohup mysql -uroot -p4кй34кn billing < update_008.sql > 008.log& |