You are here: Sorting the result « MsSQL Server « IT news, forums, messages
Sorting the result

Posted by Philippe Signoret on 04/24/06 08:50

If this is in the wrong group lemme know and I'll re-post it to the
correct one. I am using PHP and MySQL.

Suppose I have a table named "servicios" with 5 columns and 200 rows.

If I want to get the whole table sorted by column 3 (suppose the field
name is "nf") I use:

SELECT * FROM `servicios` ORDER BY `nf` ASC

This workd perfectly.

If I want to get just the first 10 rows with _no_ sorting I would use:

SELECT * FROM `servicios` LIMIT 10

This also works perfectly.

Now, if I want to get the first 10 rows, sorted by "nf", I use:

SELECT * FROM `servicios` ORDER BY `nf` ASC LIMIT 10

This does NOT work perfectly. The result I get is the first 10 rows of
whole table which has been sorted by "nf". What I want is just the
resulting first 10 rows to be sorted by "nf", not the whole table.

How can I do this?

Thanks,
Philippe

P.S. I am very new to MySQL, please forgive any unforgivable begginer
mistakes.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация