Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

Re: Sorting SQL results

by sundialsvc4 (Abbot)
on Oct 15, 2013 at 03:35 UTC ( #1058234=note: print w/ replies, xml ) Need Help??

in reply to Sorting SQL results

My general suggestion is that you should always use ORDER BY in your SQL statement, so that you specify the ordering that you require, if you care at all about the order.   Otherwise, the ordering of rows in any SQL query is defined to be:   “unpredictable.”   It can vary from query to query, and it certainly can be expected to vary as the table-size grows.

Comment on Re: Sorting SQL results
Replies are listed 'Best First'.
Re^2: Sorting SQL results
by roboticus (Chancellor) on Oct 15, 2013 at 10:22 UTC


    The ORDER BY clause tells the database to sort the rows into order. The OP had difficulty getting the columns in the correct order.

    While the title of the post does suggest that an ORDER BY clause may be appropriate, sometimes you need to read the body of the post in order to compose a relevant reply.


    When your only tool is a hammer, all problems look like your thumb.

      Does his question involve the table format too?
      use Text::ASCIITable;
      Maybe be part of the solution....


        The Text::ASCIITable package may be involved in his solution, but based on the text and the title, it looked like his primary problem was with the column ordering.


        When your only tool is a hammer, all problems look like your thumb.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1058234]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2015-11-29 07:33 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (748 votes), past polls