Skip to content

Help I'm struggling with nested data via relationships #1899

Answered by yorek
pholcroft asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @pholcroft

  1. that's right, as per design choice, relationships only work with GraphQL.

  2. I do think relationship should work on a View too, so I ask you to open an issue to improve DAB and remove this limitation.

  3. There is an issue when there are multiple relationship using the same table, and a fix is being investigated (#1859)

To return the data you want, this is the query you need:

create or alter view dbo.vw_EmailWithContacts
as
select 
    e.EmailID,
    e.Subject,
    e.BodyHTML,
    e.CreatedDate,
    c_from.EmailAddress as EmailFrom,
    json_query(EmailTo.EmailAddress) as EmailTo,
    json_query(EmailCC.EmailAddress) as EmailCC
from
    dbo.Emails e
inner join
    dbo.Email…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@pholcroft
Comment options

@yorek
Comment options

Answer selected by pholcroft
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants