Thread: Order by

    #1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2013
    Posts
    10
    Rep Power
    0

    Order by


    I've got multiple chapters in my textbook titled as such:
    Repaso A
    Repaso B
    Repaso C
    1
    2
    3

    What I'd like to do is for the Repaso's to show up first and in order, and then the numbered chapters. But apparently the numbers are a lower 'ordered' value than the "Repaso's". Can this be changed. I want them to show as above, but they currently show as below:
    1
    2
    3
    Repaso A
    Repaso B
    Repaso C

    Thanks.
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2013
    Posts
    10
    Rep Power
    0

    Order by


    I've guess I should post a little code, but it's really just the generic that everybody already knows:

    Code:
    SELECT * FROM inno_skills WHERE id = '$skill_id' ORDER BY chpt
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Jun 2009
    Posts
    677
    Rep Power
    7
  6. #4
  7. No Profile Picture
    Dazed&Confused
    Devshed Novice (500 - 999 posts)

    Join Date
    Jun 2002
    Location
    Tempe, AZ
    Posts
    506
    Rep Power
    128
    I'd just add a sort_order column to the table that you can set per chapter, however you want. Then no matter what you name chapters you'll have a consistent order.
    LinkedIn: Dave Mittner
  8. #5

  9. Join Date
    Jul 2013
    Location
    Melbourne
    Posts
    40
    Rep Power
    0
    Originally Posted by admiralq
    I've guess I should post a little code, but it's really just the generic that everybody already knows:

    Code:
    SELECT * FROM inno_skills WHERE id = '$skill_id' ORDER BY chpt
    Hi dmittner
    I think you forgot to add this code

IMN logo majestic logo threadwatch logo seochat tools logo