c# - LINQ: Compare List A and B, if in B, select item in A -
i have list of tags (list a), , list of tags matched topics (list b). want parse items in list b , if it's there, have select item in list a. i've tried 2 line , 1 line statement this, run same problem no matter try. here's 1 line attempt of code:
var tags = db.tags.where(x=>x.tagid == db.taglink.where(y => y.topicid == incomingtopicid)).tolist();
list , b have common column of tag id.
any suggestions?
update
the structure of db.taglink these columns: taglinkid(key), topicid, tagid.
the structure of db.tags these columns: tagid, tagname, istagscored.
there several ways go it. here's 1 approach:
var tags = db.tags .where(x=>db.taglink .any(y => y.tagid == x.tagid && y.topicid == incomingtopicid)) .tolist();
Comments
Post a Comment