Forum Discussion
Cyclic dependency detected while attempting query folding - SQL.
Hi all,
I'm attempting to convert a query from an SQL databse into a foldable query in order to use incremental refresh more efficiently. I am trying to use the Value.NativeQuery() function. When applying the steps i'm met with the following message.
My Advanced editor output. Apologies if SQL isn't the most efficient, i'm learning as i progress.
When using my RangeStart and RangeEnd parameters this is giving me the native query of
select [_].[Round],
[_].[Carrier],
[_].[DateTime],
[_].[PartID],
[_].[QtyMissed],
[_].[Description]
from
(
select
Round,
Carrier,
DateTime,
PartID,
QtyMissed,
Description
from
(
select
MissedCarrierID,
Round,
Carrier,
DateTime,
MissedCarrierReasonID,
PartID,
QtyMissed
from
MissedCarriers
) a
left join (
select
MissedCarrierID,
Description
from
MissedCarrierReasons
) b on a.MissedCarrierReasonID = b.MissedCarrierID
) as [_]
where [_].[DateTime] >= convert(datetime2, '2022-01-01 00:00:00') and [_].[DateTime] <= convert(datetime2, '2022-02-01 00:00:00')
So it looks like it behaving as i would like it to until i click apply. Has anybody else experienced this? Any help would be greatly appreciated. I've tried on a few different quieries but all doing the same thing. I was hoping for a way to do this without needing a view already joining the two tables.
Thanks in advance for any advice.
1 Reply
- v-chenwuz-msftCommunity Support
Hi BenJCross95 ,
Does the problem occur when using your sql statement query alone?
Is there a relationship between this table with other tables?
Best Regards
Community Support Team _ chenwu zhu