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
https://forums.phpfreaks.com/topic/117123-mysql-query-help-pls/
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
https://forums.phpfreaks.com/topic/117123-mysql-query-help-pls/#findComment-602425
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.