Page 1 of 1

linq help...

Posted: Wed 30 Sep 2009 12:08
by actuary
Hi guys,

Help needed in this scenario. I have 2 tables, Articles and Sectors and they have many-many relationship, hence another table, Article_Sectors. An example:

Article:

ArticleId

Name

---------------------------

Sectors:

SectorId

Name

ParentSectorId

---------------------------

Article_Sectors

ArticleId

SectorId


Now, the requirement is that I want 1 article per CHILD sector. E.g if the parentsectorid is 3 and if there are 4 sectors under that parent, then I would need to show 1 article (latest as per the date column in the article table) for all the 4 subsectors. Something like

Result:

ParentSectorId

SectorId

SectorName

ArticleId

ArticleName


Help needed.

Thanks