On Thu, May 15, 2008 at 4:32 PM, C.R.Vegelin <[EMAIL PROTECTED]> wrote: > What about: > "ALTER TABLE <tablename> > ORDER BY <fieldname>;" > > HTH, Cor
First off, please don't top post if a conversation is not already top posting. It is the custom of the group to bottom post... Your solution does not remove the gaps in his data. " ORDER BY enables you to create the new table with the rows in a specific order. Note that the table does not remain in this order after inserts and deletes. This option is useful primarily when you know that you are mostly to query the rows in a certain order most of the time. By using this option after major changes to the table, you might be able to get higher performance. In some cases, it might make sorting easier for MySQL if the table is in order by the column that you want to order it by later." http://dev.mysql.com/doc/refman/5.0/en/alter-table.html mysql> DROP TABLE IF EXITS t1; Query OK, 0 rows affected (0.00 sec) mysql> CREATE TABLE `t1` (`col1` int,`col2` int); Query OK, 0 rows affected (0.03 sec) mysql> INSERT INTO t1 VALUES(0,1),(3,2),(5,3),(7,4),(9,5),(11,6),(15,7); Query OK, 7 rows affected (0.00 sec) Records: 7 Duplicates: 0 Warnings: 0 mysql> ALTER TABLE t1 ORDER BY col1; Query OK, 7 rows affected (0.06 sec) Records: 7 Duplicates: 0 Warnings: 0 mysql> SELECT * FROM t1; +------+------+ | col1 | col2 | +------+------+ | 0 | 1 | | 3 | 2 | | 5 | 3 | | 7 | 4 | | 9 | 5 | | 11 | 6 | | 15 | 7 | +------+------+ 7 rows in set (0.00 sec) -- Rob Wultsch [EMAIL PROTECTED] wultsch (aim) -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]