seantis/seantis-questionnaire — pull request #33 by daniboy (2014-11-02 22:04:41+00:00)
Title: Perform natural sort on question number.

Currently the question with the number "10" comes before the question with the number "1" because the sort is done on string characters, not on natural numbers. This patch casts the "number" fields to an integer and sorts by the casted number first, and by the string number later (so that the order will be "1", "1a", "2", …, "10", "10a", "10b")

CAST is ANSI SQL and I tested this implementation on both SQLite and MySQL.