Child pages
  • Примеры отчетов

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

Пользователи без сервисов
SELECT id as login, uid
FROM users
WHERE uid NOT IN (SELECT uid FROM internet_main)
AND uid NOT IN (SELECT uid FROM iptv_main);
Счета пользователей (по диапазонам)
SELECT
CASE
  WHEN b.deposit < 0 THEN "1. Меньше 0"
  WHEN b.deposit >= 0  AND b.deposit < 100 THEN "2. От 0 до 100"
  WHEN b.deposit >= 100  AND b.deposit < 500 THEN "3. От 100 до 500"
  ELSE "4. Больше 500"
END as deposit_value,
count(u.uid) as user_count, SUM(b.deposit) as total_sum
FROM users u
LEFT JOIN bills b ON (u.uid=b.uid)
group by deposit_value
order by deposit_value;


  • No labels