MarkMpn / Sql4Cds

SQL 4 CDS core engine and XrmToolbox tool
MIT License
74 stars 22 forks source link

XXX is not a unique alias #425

Closed sybaris closed 9 months ago

sybaris commented 9 months ago

Hi,

When I try to execute my query

WITH TableA(name, createdbyname,modifiedbyname
) AS 
(select top 10  W.name, U1.fullname 'createdbyname',U2.fullname 'modifiedbyname'
from webresource W
inner join systemuser U1 on U1.systemuserid= W.createdby
inner join systemuser U2 on U2.systemuserid= W.modifiedby
),
TableB(name, createdbyname,modifiedbyname
) AS 
(select top 10  W.name, U1.fullname 'createdbyname',U2.fullname 'modifiedbyname'
from webresource W
inner join systemuser U1 on U1.systemuserid= W.createdby
inner join systemuser U2 on U2.systemuserid= W.modifiedby
)
select * from TableA
union 
select * from TableB

I have the following error : createdbyname is not a unique alias System.ArgumentException: createdbyname is not a unique alias Parameter name: alias See the Execution Plan tab for details of where this error occurred

image

My original query is very much more complex, but I have simplified the query...

I use the 8.0.0 version of SQL4CDS Regards Sybaris