Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2

Thread: Case null

  1. #1
    Senior Coder
    Join Date
    Dec 2005
    Location
    Slovenia
    Posts
    1,990
    Thanks
    120
    Thanked 76 Times in 76 Posts

    Case null

    since as it looks like I cant use NULL comparison insside case statement, how can I order this
    Code:
     
    b
    null
    a 
    null
    ...
    into

    Code:
     
    a
    b 
    null
    null
    ...
    ?
    Last edited by BubikolRamios; 03-17-2013 at 11:25 PM.
    Found a flower or bug and don't know what it is ?
    agrozoo.net galery
    if you don't spot search button at once, there is search form:
    agrozoo.net galery search

  • #2
    Senior Coder
    Join Date
    Dec 2005
    Location
    Slovenia
    Posts
    1,990
    Thanks
    120
    Thanked 76 Times in 76 Posts
    found solution here: http://dev.mysql.com/doc/refman/5.0/...with-null.html

    If you want to have NULL values presented last when doing an ORDER BY, try this:

    SELECT * FROM my_table ORDER BY ISNULL(field), field [ ASC | DESC ]
    Found a flower or bug and don't know what it is ?
    agrozoo.net galery
    if you don't spot search button at once, there is search form:
    agrozoo.net galery search


  •  

    Posting Permissions

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