http://www.perlmonks.org?node_id=1058234


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

    sundialsvc4:

    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.

    ...roboticus

    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....

        spandox:

        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.

        ...roboticus

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