Skip to content

How to get data from a Many-To-Many relation #178

Answered by s3312345
mongeon asked this question in Q&A
Discussion options

You must be logged in to vote

You need to specify an inner join such as below. I also had a problem getting my head around the querying format, it doesn't work like linq as it does not translate it into a sql query like a traditional direct linq query to the SQL DB.

The other (more expensive) alternative is to bring back all the books and then you can use linq to filter the "Models" collection as each Book item will have it's Author filled. But beware that each item in Models has a null 'BaseUrl' hence you can't use that item to call Update on it.

Good luck

await client
            .From<Book>()
              .Select("*, Author_info:Author!inner(*)")
              .Filter("Author.id", Constants.Operator.Equals, author…

Replies: 1 comment 2 replies

Comment options

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

@baileyfrye1
Comment options

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