On 2 May 2013, at 9:26am, Gert Van Assche <[email protected]> wrote:
> I have a table with 2 fields that need to be exported to 2 TXT files but > the order of the lines in the export should be exactly the same as in the > table. Tables do not have order. Really. A table is a set of rows, not an ordered set of rows. If you do not specify ORDER BY on a unique set of values, the same SELECT can returns the same rows in different orders. > I tried to do it like this: > SELECT [FieldA] FROM [T1] ORDER BY rowid; > and > SELECT [FieldB] FROM [T1] ORDER BY rowid; > but the rowid order is not followed. The two TXT files that are created are > not in sync. If you have unique values in rowid, and really are doing those two commands in the same transaction (so nothing can write to the table between them), and getting rows returned in different orders, something is weird about your setup. In your software do SELECT [FieldA],[FieldB] FROM [T1] ORDER BY rowid Use your software to make one text file from the first values and another from the second values. It will be faster too ! Simon. _______________________________________________ sqlite-users mailing list [email protected] http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

