Re: insert ... select .. order by problem
Alejandro Paz <[email protected]>
| Newsgroups | gmane.comp.db.mysql.bugs |
|---|---|
| Message-ID | <[email protected]> |
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; I thought that was clear when I said reverse order, sorry. --- Sergei Golubchik <[email protected]> wrote: > Hi! > > On Sep 01, Alejandro Paz wrote: > > Hallo everyone ! > > > > I already sent this, but I think some people think > is > > not clear enough ;-) > > > And the statement I am using is : > > > > INSERT INTO PTemp SELECT d,e,32,'E' FROM Stock > WHERE > > h<i ORDER BY a,b,c; > > > > I am doing an insert/select with order by, in both > > cases I am using the same statemant. > > > > When I use the same statement in my application > (built > > with C, and statically linked > > to libmysqlclient.a) I get the reversed order. > > > > When I test the statement in the mysql cli and I > get > > the results well sorted. > > What "results" do you mean here ? > INSERT command does not return any results. > > Regards, > Sergei > > -- > __ ___ ___ ____ __ > / |/ /_ __/ __/ __ \/ / Sergei Golubchik > <[email protected]> > / /|_/ / // /\ \/ /_/ / /__ MySQL AB, Senior > Software Developer > /_/ /_/\_, /___/\___\_\___/ Osnabrueck, Germany > <___/ www.mysql.com __________________________________ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com -- MySQL Bugs Mailing List For list archives: http://lists.mysql.com/bugs To unsubscribe: http://lists.mysql.com/[email protected]