Why would you want to do this?

If you require a SELECT to return rows in a certain order, you need to specify 
ORDER BY on the SELECT statement. And not rely on ascending insert time or any 
other visitation order effect.

Additionally - unless specific precautions are taken - sorted insert results in 
a half empty tree structure.

-----Ursprüngliche Nachricht-----
Von: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] Im 
Auftrag von André Borchert
Gesendet: Sonntag, 25. August 2019 23:10
An: sqlite-users@mailinglists.sqlite.org
Betreff: [EXTERNAL] [sqlite] ORDER BY is ignored during INSERT INTO

Hello,

I try to copy one table into a second identical one. Once the second table is 
created I want to move the content over sorted by ASC.

The issue is that the ORDER BY statement gets ignored during a INSERT INTO:

INSERT INTO CompanyDetails2 SELECT * FROM CompanyDetails WHERE 
CompanyDetails.ID > 0 ORDER BY CompanyDetails.RIC ASC

When the SELECT query is executed alone, the content is sorted fine as expected.

Andre
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


___________________________________________
 Gunter Hick | Software Engineer | Scientific Games International GmbH | 
Klitschgasse 2-4, A-1130 Vienna | FN 157284 a, HG Wien, DVR: 0430013 | (O) +43 
1 80100 - 0

May be privileged. May be confidential. Please delete if not the addressee.
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to