Re: insert ... select .. order by problem
Sergei Golubchik <[email protected]>
| Newsgroups | gmane.comp.db.mysql.bugs |
|---|---|
| Message-ID | <[email protected]> |
Hi! On Sep 02, Alejandro Paz wrote: > Hi, > > I use ORDER BY, because I want that order in PTemp > table, so I do not have to order them later (because > they are retrieved several times later). > > 1. Inserting with mysql c.l.i. : > > I get the records well sorted : first by a, secondly > by b and finally by c (ascendig order). I'm using d to > relink both tables in a join. > > select a,b,c from Stock,PTable where Stock.d=PTable.d; > > 2. Inserting with the application : > > I get the records badly sorted : first by a, secondly > by b and finally by c, but in descending order. As all > records has the same value in a, so the records that > in case 1 start with '0' are at the beginning, the > same records here are at the end. I'm using d to > relink both tables in a join. > > select a,b,c from Stock,PTable where Stock.d=PTable.d; Are you sure everything else is the same for both cases ? Same mysqld version, same initial content for both tables, same settings for mysqld variables ? Did you execute both insert and select from mysql cli and your application - or only insert from mysql cli and your application and then select from mysql cli ? (here, I use "insert" for your "INSERT ... SELECT ... ORDER BY" command, and "select" for "SELECT ... FROM ... WHERE Stock.d=PTable.d" command") Try to run - on the same server, with the same settings, same table content - all the four combinations: insert in mysql cli, select in mysql cli insert in your app, select in mysql cli insert in mysql cli, select in your app insert in your app, select in your app Don't forget to restore initial PTable content after each try. Regards, Sergei -- __ ___ ___ ____ __ / |/ /_ __/ __/ __ \/ / Sergei Golubchik <[email protected]> / /|_/ / // /\ \/ /_/ / /__ MySQL AB, Senior Software Developer /_/ /_/\_, /___/\___\_\___/ Osnabrueck, Germany <___/ www.mysql.com -- MySQL Bugs Mailing List For list archives: http://lists.mysql.com/bugs To unsubscribe: http://lists.mysql.com/[email protected]