Is it possible to write this SQL query as a Fetch XML query? http://www.sql2fetchxml.com fails to convert this query.
select a.ownerid, b.call_count
from opportunity a
join (
select vsg_loan, count(*) as 'call_count'
from phonecall
group by vsg_loan
having count(*) = 2) b
on a.opportunityid = b.vsg_loan
order by b.call_count
I expect the result to be something like this...

Dataverse now has a TDS endpoint, so you can just use that query directly.