Hi Albert, you are not misunderstanding me :-) Tables can indeed not be sorted, it's output which gets sorted. The difference is not academic, but important: It's not the table which gets an order, but the output. Take a command like: insert into x ... select from y ... order by z. Here the output of select gets sorted and inserted into the table x. In this table, there is not order, so if you do then a select from x, the order is arbitrary again and you need to do select from x order by z. And this means you could have dropped the order by in insert totally. Hope it became clear. Stefan
Am Tuesday 02 September 2003 13:20 schrieb Albert: > Stefan, > > Do you imply that tables cannot be sorted desc or asc based on one of the > columns e.g. a last name? or am I misunderstanding you. > > Albert > Atlanta > (anyone else in Atlanta?) > > > > ----- Original Message ----- > From: "Stefan Kuhn" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Tuesday, September 02, 2003 6:57 AM > Subject: Re: insert ... select .. order by, problem > > > Hi, > > I think you can't do this. There is no order in the table, so there is no > > point in using order by with insert. You always have to do this when > > retrieving the records (the order you get with select without order by is > > accidential). > > HTH > > Stefan > > > > Am Tuesday 02 September 2003 11:49 schrieb Alejandro Paz: > > > Hi Stephan, > > > > > > Let's see the case : > > > > > > 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. > > > > > > 2. Inserting with the application : > > > > > > I get the records well 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. > > > > > > I thought that was clear when I said reverse order, > > > sorry. > > > > > > So you see what I mean ? > > > > > > thanks ! > > > > > > __________________________________ > > > Do you Yahoo!? > > > Yahoo! SiteBuilder - Free, easy-to-use web site design software > > > http://sitebuilder.yahoo.com > > > > -- > > Stefan Kuhn M. A. > > Cologne University BioInformatics Center (http://www.cubic.uni-koeln.de) > > Zülpicher Str. 47, 50674 Cologne > > Tel: +49(0)221-470-7428 Fax: +49 (0) 221-470-7786 > > My public PGP key is available at http://pgp.mit.edu > > > > > > -- > > MySQL General Mailing List > > For list archives: http://lists.mysql.com/mysql > > To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] -- Stefan Kuhn M. A. Cologne University BioInformatics Center (http://www.cubic.uni-koeln.de) Zülpicher Str. 47, 50674 Cologne Tel: +49(0)221-470-7428 Fax: +49 (0) 221-470-7786 My public PGP key is available at http://pgp.mit.edu -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]