Describe the bug
When a LEFT JOIN with multiple conditions is used and there are also multiple conditions in the WHERE clause, the filter in the FetchXML is duplicating a specific property but probably using different values so the result table is empty.
To Reproduce
Query to reproduce the behavior:
SELECT
prd.mserp_dataareaid,
prd.mserp_productnumber,
prd.mserp_purchaseunitsymbol,
prf.mserp_factor
FROM
mserp_ecoresreleasedproductv2entity prd
LEFT JOIN mserp_ecoresproductunitofmeasureconversionentity prf
ON prf.mserp_productnumber = prd.mserp_productnumber
AND prf.mserp_fromunitsymbol = prd.mserp_purchaseunitsymbol
AND prf.mserp_tounitsymbol = 'm2'
WHERE 1 = 1
AND prd.mserp_dataareaid = 'usmf'
AND prd.mserp_productnumber = 'testproduct'
produces this Execution Plan:
and NULL in the Result:
If I comment the dataareaid:
SELECT
prd.mserp_dataareaid,
prd.mserp_productnumber,
prd.mserp_purchaseunitsymbol,
prf.mserp_factor
FROM
mserp_ecoresreleasedproductv2entity prd
LEFT JOIN mserp_ecoresproductunitofmeasureconversionentity prf
ON prf.mserp_productnumber = prd.mserp_productnumber
AND prf.mserp_fromunitsymbol = prd.mserp_purchaseunitsymbol
AND prf.mserp_tounitsymbol = 'm2'
WHERE 1 = 1
-- AND prd.mserp_dataareaid = 'usmf'
AND prd.mserp_productnumber = 'testproduct'
the Execution Plan fetches more or less all rows (which is better than filtering too much):
and in the result the correct factor is shown:
Expected behavior
The filter should be either correct or fetch all data and join local.
Screenshots
Same thing in the real world example:
Again it works when I only leave 1 condition in the WHERE clause:
Environment (please complete the following information):
- SQL 4 CDS edition: XrmToolBox v1.2025.10.74, 10.3.0.0 & MarkMpn.Sql4Cds.Engine 10.3.0
- Results of
SELECT @@VERSION:
Microsoft Dataverse - 9.2.26041.172
SQL 4 CDS - 10.3.0.0
Apr 10 2026 11:13:54
Copyright © 2020 - 2025 Mark Carrington
Describe the bug
When a
LEFT JOINwith multiple conditions is used and there are also multiple conditions in theWHEREclause, thefilterin theFetchXMLis duplicating a specific property but probably using different values so the result table is empty.To Reproduce
Query to reproduce the behavior:
produces this
Execution Plan:and
NULLin theResult:If I comment the
dataareaid:the
Execution Planfetches more or less all rows (which is better than filtering too much):and in the result the correct factor is shown:
Expected behavior
The filter should be either correct or fetch all data and join local.
Screenshots
Same thing in the real world example:
Again it works when I only leave
1condition in theWHEREclause:Environment (please complete the following information):
SELECT @@VERSION:Microsoft Dataverse - 9.2.26041.172
SQL 4 CDS - 10.3.0.0
Apr 10 2026 11:13:54
Copyright © 2020 - 2025 Mark Carrington