Skip to content

Instantly share code, notes, and snippets.

select count(*) from (select a.* from (select * from auth_user where created_by_user_id in (select id from auth_user where user_type <> 'ADMIN')) a left join agent on a.id = agent.user_id where a.id in (select id from auth_user where user_type = 'AGENT')) t where id in (select user_id from agent);