# Query for the partner corps from overwatch
SELECT id, registered_name from clientdb_clients;
# Query for total sales from limitless
select
partner_corp_id,
clients.name,
billing_state,
sum(coalesce(discount_total, ledger.total)) as total
from ledger
join orders o on o.id = order_id
join gateways g on g.id = gateway_id
left join (
SELECT '33B043F094DC0454B049B961479152782374' as id,' - Chelsea Media LLC' as name
UNION ALL SELECT '33B538C5CFD9727C0FDD6D91545792618755',' Cannabis Doctor LLC'
UNION ALL SELECT '33BA0EB0997B34111CA91A41545792724825',' Cannabis Doctor LLC'
# ... ... ... ... ... ... ... ... ... -> See above query
) as clients on clients.id = partner_corp_id
where transaction_id is not null
and processed_at is not null
and cancelled_at is null
and voided_at is null
and ledger.test = 0
# UTC Timezone
and processed_at between '2019-01-01 00:00:00' and '2019-09-23 23:59:59'
and billing_country in ('US', 'USA')
group by partner_corp_id, billing_state
order by total desc;