On 17/08/2005, Schimmel LCpl Robert B wrote:

> If I do a select * from the table
> without an order by clause, I get the results in the order which they
> were entered into the table (which is how I want them). 

This is not correct (e.g. on a MyISAM table in which you have done
deletes - see example below)

> When I do a select [column_name] from the table, because
> of MySQL's go-getter attitude, the results are sorted alphabetically
> for that one column. 

When [column_name] is indexed, MySQL will only use the index to get
your records (to boost performance) and in the index the records are
ordered.

> How can I get just the one column of data that I
> want returned in the order which it was entered into table?

You can't unless you follow the advise of the other posters in this
thread.

Example:

USE test;
DROP TABLE foo;
CREATE TABLE foo (
        a CHAR(10),
        b CHAR(10)
        
) ENGINE=MyISAM;

INSERT INTO foo VALUES
('a', 'a'), ('b', 'b'), ('d', 'd'), ('c', 'c');


SELECT a FROM foo;
SELECT * FROM foo;

ALTER TABLE foo ADD INDEX (a);

SELECT a FROM foo;
SELECT * FROM foo;


DELETE FROM foo WHERE a = 'a';
INSERT INTO foo VALUES ('x', 'x');

SELECT a FROM foo;
SELECT * FROM foo;


-- 
felix

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to