SELECT 'group' AS t, id, name, status, platform, coalesce(default_mapped_model,''), coalesce(cast(fallback_group_id as text),'')
FROM groups WHERE id IN (6,43);

SELECT 'account_group' AS t, ag.group_id, ag.account_id, a.name, a.platform, a.status, a.priority
FROM account_groups ag
JOIN accounts a ON a.id = ag.account_id
WHERE ag.group_id IN (6,43)
ORDER BY ag.group_id, a.priority, a.id;
