Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

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.

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 all is quiet...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2018-02-23 07:33 GMT
Find Nodes?
    Voting Booth?
    When it is dark outside I am happiest to see ...

    Results (300 votes). Check out past polls.