Jump to content

MYSQL Query help pls?


woolyg

Recommended Posts

Hi,

I'm having a brainfreeze, could someone help?

 

CREATE TABLE IF NOT EXISTS `players` (
  `player_id` int(11) unsigned NOT NULL auto_increment,
  `player_name` varchar(64) collate latin1_general_ci NOT NULL,
  PRIMARY KEY  (`player_id`),
  FULLTEXT KEY `player_name` (`player_name`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;


INSERT INTO `soccer_players` VALUES (1, 'Player1');
INSERT INTO `soccer_players` VALUES (2, 'Player2');
INSERT INTO `soccer_players` VALUES (3, 'Player3');
INSERT INTO `soccer_players` VALUES (4, 'Player4');
INSERT INTO `soccer_players` VALUES (5, 'Player5');
INSERT INTO `soccer_players` VALUES (6, 'Player6');
INSERT INTO `soccer_players` VALUES (7, 'Player7');
INSERT INTO `soccer_players` VALUES (8, 'Player8');
INSERT INTO `soccer_players` VALUES (9, 'Player9');
INSERT INTO `soccer_players` VALUES (10, 'Player10');

 

 

I'm trying to select 5 player_id, ordered by player_id DESC, then output them as follows:

 

5 - 6 - 7 - 8 - 9 - 10

 

Can anyone help?

 

Thanks,

WoolyG

Link to comment
Share on other sites

I'm sorry, the brainfreeze is obviously affecting my communication too..  ::)

 

I'm using:

 

SELECT players.player_id  
FROM players
ORDER BY players.player_id DESC LIMIT 5

 

..but that's outputting

 

10,9,8,7,6

 

..and I'd *like* to output

 

6,7,8,9,10

(where 10 is the very highest player_id)

 

Do you get me? sorry for the confusion...

W

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.