TSQL Challenge 28




TSQL Challenge 28 - SELECT TOP N articles from each category from a SQL Server 2000 database

The challenge is to write a query that returns the articles to be displayed in the home page of the website. N number of articles from each category is to be selected where N is configured in the Categories table. Each category should select the most recent N articles. ArticleID can be used to identify the most recent articles. An article with a higher number indicates a more recent article.

Though an article can fall into multiple categories, the home page can display an article only under one category. When you select the articles, do not select the same article under multiple categories. A category with a lower category ID should get the first preference to select articles that falls into that category.