SELECT word FROM tablename ORDER BY id ASC #### ALTER TABLE tablename ADD INDEX(line_n); ALTER TABLE tablename ADD INDEX(word_position); ALTER TABLE tablename ADD INDEX(line_n,word_position); SELECT word FROM tablename USE INDEX(line_n,word_position) ORDER BY (line_n*100+word_position) ASC;