Hi,
I am trying to translate the following SQL query to a QueryExpression:
SELECT a.AccountId, o.opportunityid FROM dbo.Account a INNER JOIN dbo.Opportunity o ON o.CustomerId = a.AccountId LEFT JOIN dbo.new_creditpackagefile cpf ON cpf.new_accountid = o.CustomerId AND cpf.new_opportunityid = o.OpportunityId AND cpf.new_documenttype = 32;
Here's how I would rewrite the above SQL to be possible via QueryExpression:
SELECT DISTINCT a.AccountId, o.opportunityid FROM dbo.Account a INNER JOIN dbo.Opportunity o ON o.CustomerId = a.AccountId LEFT JOIN dbo.new_creditpackagefile cpf ON cpf.new_accountid = o.CustomerId AND cpf.new_documenttype = 32 LEFT JOIN dbo.new_creditpackagefile cpf2 ON cpf2.new_opportunityid = o.OpportunityId AND cpf2.new_documenttype = 32
The downside of the second query is that it uses another left join and the DISTINCT operator.
Questions:
- Do you think the additional join and DISTINCT operator would have a meaningful performance hit?
- Will there be support for multiple join conditions in the future?
Thank you very much!