Need help with the Advanced Sql Queries

Need help with the Advanced Sql Queries

  
I am new to Outsystems and new to this Advanced Sql Queries as well. I am trying to create a new query but it shows error, this is my query

SELECT {User}.[Name],
       {User}.[Username],
       {User}.[Email],
       {Role}.[Name]

FROM {User}

INNER JOIN {ProjectParticipant} ON {User}.[Id] = {ProjectParticipant}.[UserId] AND {ProjectParticipant}.[ProjectId] = @ProjectId
INNER JOIN {User_Role} ON {User}.[Id] = {User_Role}.[User_Id] AND {User}.[Tenant_Id] = {User_Role}.[Tenant_Id]
INNER JOIN {Role} ON {User_Role}.[Role_Id]= {Role}.[Id]

GROUP BY {User}.[Username],
         {User}.[Name],
         {User}.[Email],
         {Role}.[Name]

ORDER BY @OrderBy

It shows me error in the {Role}.[Name].Any help is greatly appreciated. Thanks
Hi,

The query itself looks OK, the only thing I'm not sure is the Order by variable.
Is the OrderBy input set to expand inline? If it's not set to expand inline and you are passing "{Role}.[Name]" as a value it will cause an error.

Also, I'm assuming it is a runtime error, and not a validation error in service studio, right?


Regards,
João Rosado
Yes it was throwing error at run time. Now it is working thanks.
Hi vdha,

Just out of curiosity, why do you need to use the SQL node for this query?