SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Evangelist
    Join Date
    Jun 2010
    Posts
    455
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    is there a better way

    I have a column called priority that's an INT.

    When I INSERT, the value in priority defaults to 0.

    When I ORDER the column the zeros go to the top of the list.

    I want them at the bottom of the list so I simply recode all zeros to 99. That solves my problem, but I'd like to know if there's a better way?

  2. #2
    Hosting Team Leader silver trophybronze trophy
    cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    5,220
    Mentioned
    153 Post(s)
    Tagged
    0 Thread(s)
    I'm assuming you still want 1, 2 and 3 towards the top of the list so ORDER BY priority DESC would be out of the question. Couldn't you just change the default to 99 instead of 0?

  3. #3
    SitePoint Evangelist
    Join Date
    Jun 2010
    Posts
    455
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    For everything there is a first time. Never thought of it that way, DUH! More proof that I see what I expect to see.

    Thanks cpradio.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •