How do I simulate the cross apply in an Azure Data Factory Data flow?
SELECT
wo.OrderId,
max(wo.OrderVersionId) as OrderVersionId,
max(tss.FromDate) as TSSFromDate,
tss.ToDate as TSSToDate
FROM dayshift.OrderMain wo CROSS APPLY (
SELECT
(
SELECT
MIN(wo.OrderEndDate) as OrderLastDate
FROM
(SELECT
wo.OrderEndDate
UNION
SELECT
wo.OrderTerminationDate
WHERE
wo.OrderTerminationDate IS NOT NULL
)
d
)
) woEnd
INNER JOIN dayshift.TSSchedule tss
ON wo.OrderTimeCycleId = tss.TimeCycleId
and WoEnd.OrderLastDate >= tss.FromDate
and wo.OrderStartDate <= tss.ToDate;
I tried to create 2 branches for the CTE to get the union between wo.OrderEndDate and wo.OrderTerminationDate but my challenge is how to integate the cross apply into the main data flow;
Here is a sample data;