linq help...

Discussion of open issues, suggestions and bugs regarding LinqConnect – Devart's LINQ to SQL compatible ORM
Post Reply
actuary
Posts: 3
Joined: Tue 28 Jul 2009 09:34

linq help...

Post by actuary » Wed 30 Sep 2009 12:08

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

Post Reply