Web Analytics Made Easy -
StatCounter 'Order by' - CodingForum

Announcement

Collapse
No announcement yet.

'Order by'

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 'Order by'

    Hi.
    I got a problem with this code...

    Code:
    <%
    Set rsTimer= Server.CreateObject("ADODB.Recordset")
    strSQL = "SELECT * FROM Times WHERE CustID="&strID&" ORDER BY month ASC"
    rsTimer.Open strSQL, strCon
    %>
    (The code is in ASP.)

    The output is:
    1,10,11,12,2,3,4,5,6,7,8,9

    It should be:
    1,2,3,4,5,6,7,8,9,10,11,12

    Why?
    Last edited by guelphdad; Oct 5, 2006, 02:21 PM. Reason: added code tags

  • #2
    because your record type is in char or varchar format. Either change your format to tinyint or else use:
    Code:
    order by month + 0
    which will force the ordering to believe your strings are numeric in nature.

    Comment


    • #3
      Thanks guelphdad

      Comment

      Working...
      X