Querying a link table (ish)

Thread is closed for posting
2 posts, 0 answers
  1. Steve
    Steve avatar
    1887 posts
    Member since:
    Dec 2008

    Posted 24 Sep 2010 Link to this post

    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 :)
  2. Zoran
    Zoran avatar
    534 posts

    Posted 29 Sep 2010 Link to this post

    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,
    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
Back to Top