This is a migrated thread and some comments may be shown as answers.

Querying a link table (ish)

1 Answer 37 Views
LINQ (LINQ specific questions)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
sitefinitysteve asked on 25 Sep 2010, 01:37 AM
I have a Product table, Category table, and a Linktable with a sortIndex column.

How do I write a query to say

Show me all products in X Category, where the Categorys ParentID column is Y

I cant seem to figureout where to go on this one :)

1 Answer, 1 is accepted

Sort by
0
Zoran
Telerik team
answered on 29 Sep 2010, 06:44 PM
Hello Steve,

 I am not sure if I got your idea right tis time, but here is my best guess for what you had in mind with your lat letter:

var products = (from c in context.Categories
           where c.ParentID = 'Y').SelectMany(c => c.Products);

All the best,
Zoran
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
LINQ (LINQ specific questions)
Asked by
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
Answers by
Zoran
Telerik team
Share this question
or