Does anyone know how to write a query that can replicate a SQL UNION statement in Fetch XML?
Hello,
I'm with David - it's not possible to create something similar to SQ Union in FetchXml but... there is a workaround you can use and it is described here - butenko.pro/.../
This isn't possible. If you are submitting the FetchXml query via code (e.g. via RetrieveMultiple), it is relatively simple to submit multiple queries and combine the result sets in code. However, if using FetchXML in a report then there is no useful workaround.
In a few specific cases you could contrive a workaround by rewriting the query to join to a common entity - for example if you wanted all leads and opportunities created by a user, you could use the following query, then have a calculated column to combine either the lead subject or opportunity name. Note the use of outer joins.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156