Hi,
I need to create a BulkDeleteRequest and the QueryExpression (i.e. the BulkDeleteRequest's QuerySet) required looks like this when expressed in SQL:
SELECT *
FROM [dbo].[vdi_contactrecord] as contactrecord
INNER JOIN [dbo].[vdi_contactdataset] as dataset
ON dataset.vdi_contactdatasetId = contactrecord.vdi_contactdatasetnameguid
WHERE
contactrecord.CreatedOn < DATEADD(day,-7,GETDATE())
AND
( dataset.vdi_date <> contactrecord.vdi_versiondate
OR dataset.vdi_version <> contactrecord.vdi_version)
(There will also need to be an additional clause to check the BusinessUnit.)
Is it possible to express the above as a QueryExpression? I can already do the join, the BU check and, I think, the date comparison. The problem I keep running into are those 2 last clauses: I can find no way to compare an attribute in the first entity with an attribute in the second (linked) entity. It seems like this basic SQL functionality is entirely missing from QueryExpression - or did I miss something?
Are there alternative approaches that I should consider?
*This post is locked for comments