Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

MYSQL table NOT sorted create

9:38 am on Mar 13, 2012 (gmt 0)

New User

5+ Year Member

joined:Mar 7, 2012
votes: 0

I wish to create a table. using MYSQL and which content of one field will be imported from an external file. I wish to always be able to keep its original format of this field, i.e I can always recreate the original order in the data was entered, even after some sorting of various other fields.

Will be very grateful for your help
3:41 pm on Mar 13, 2012 (gmt 0)

Senior Member

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Nov 28, 2004
votes: 0

If you use an auto_increment field, it will increment that field in the order you insert it and if it's set as the primary key will be the default sorting. So

record 1
record 2
record 3
record 4

create table test (id int(11) primary key auto_increment, textfield text)

then via automation or import or whatever,

insert into test (textfield) values ('record 1');
insert into test (textfield) values ('record 2');
insert into test (textfield) values ('record 3');
insert into test (textfield) values ('record 4');

should produce

1|record 1
2|record 2
3|record 3
4|record 4

so select textfield from test (without ordering) should output them in that order.

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members