Jump to content

Create table with most four most recent items


katie77

Recommended Posts

Hi there,

 

I have a table containing News items grouped into different categories, like so:

 

CategoryStory Date

SportTeam wins match14Oct2007

SportTeam does not win match15Oct2007

SportFootball results16Oct2007

SportHockey player falls over01Nov2007

SportHooligans spoil match12Sep2007

 

BuinessBank collapses14Oct2007

BuinessCompany boss gets the sack24Oct2007

BuinessFTSE 10029Oct2007

BuinessManager found asleep under the table30Oct2007

BuinessTramp inherits world's biggest company19Nov2007

 

PoliticsPrime Minister trips over pavement15Oct2007

PoliticsPresident visits North Pole18Oct2007

 

From this table, I would like to create another table containing the 4 most recent stories in each category, where story1 is the most recent.  It would look like this:

 

Category Story1 Story2 Story3 Story4

SportHockey player falls overFootball resultsTeam does not win matchTeam wins match

BuinessTramp inherits world's biggest companyManager found asleep under the tableFTSE 100Company boss gets the sack

 

PoliticsPresident visits North PolePrime Minister trips over pavement[/td][td]

 

Does anyone know how this could be done in SQL?

 

Many thanks,

 

Katie

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.