linq to sql - Get Distnct items from a group of 2 tables -
tableowner:
id: (primary key) name
tableitems:
id (primary key) name: description: reportingowner: [ foreign key owner table)
mappeditems:
id: (primary key) itemid: (foreignkey tableitems) ownerid:(foreign key owner)
i have 3 tables , want fetch list of items in tableitems not in mappeditems specific owner. how can write linqtosql query it?
maybe this:
var owner="owner"; var result= ( item in db.tableitems !( mapped in db.mappeditems join owner in db.tableowner on mapped.ownerid equals owner.id owner.name==owner select mapped.itemid ).contains(item.id) select item ).tolist();
where db
linq data context
Comments
Post a Comment