Sort Order - Include Null al last

  • What I think was meant by that was in the select list: EmpName, DateOfLeaving. If you were to have more than 2 columns, you'd want the DateOfLeaving listed last. I base that off of looking at the requested output based on the sample data provided.

    😎

  • This is definitely wrong. Only 2nd one is correct

  • I still see the red cross on my answer :w00t:

    please please correct the answer so we all get our points back 😛


    Urbis, an urban transformation company

  • Glad I'm not the only one that was confused by this question.

    The question stated

    "The question is to have list off all employees with the employees with DateOfLeaving coming last and all others sorted ascending order of date of leaving, Name sorted in ascending order for each group"

    ie. The DateOfLeaving is to be sorted ascending.

    -- John Oliver
    Sometimes banging your head against a wall is the only solution.

  • antony (6/22/2008)


    I also picked option 2, only to be told I was wrong, and should have picked option 2!:crying:

    I had the same experiece as antony.

  • Good to know in the end that there were other people who had problems. But I wasn't as annoyed at getting it wrong has I have more than my fair share of wrong answers, more annoyed about the fact that I thought I had one I could get right for a change.

    nice that the author admitted his mistakes, and I am still learning SQL and these are a very good way to test my skill in using but more in remembering how to use the product. We all learn from our mistakes but you would hope next time for other problem questions that they go under some kind of review prior to being posted for people to answer, as I am sure that the moderators of the site have more than enough experience to be able to spot small problems like these.

    Best of luck the the future ones.

  • They have the experience, that isn't the issue. The issue is having the time to vet all the questions along with everything else they have to do to keep the site running.

    😎

  • Perhaps they figured out how much fun we have reviewing them ourselves.

    :hehe:

    Tom Garth
    Vertical Solutions[/url]

    "There are three kinds of men. The one that learns by reading. The few who learn by observation. The rest of them have to pee on the electric fence for themselves." -- Will Rogers
  • So, I'm going to get my point for this - like others have said #3 is WRONG

    Select EmpName, DateOfLeaving from Employees order by DateOfLeaving desc, EmpName asc would give you:

    EmpName DateOfLeaving

    Dcd 10 Aug 2000

    Abc 10 Oct 1999

    Bcd 11 Nov 1998

    Ccd null

    Eed null

    not

    EmpName DateOfLeaving

    Bcd 11 Nov 1998

    Abc 10 Oct 1999

    Dcd 10 Aug 2000

    Ccd null

    Eed null

    as the question stated.

    Steve - where are you to fix this one ????

  • What can I say more? I am in 94% as well.:hehe:

  • Dear bitbucket,

    Just copy and paste the T-SQL code written in my post and just execute it. You 'll get right answer.

    Alternativelty you can copy the second option and remove single quote and place the single quote again. I think it 'll work fine.

    🙂

  • Well, I think we all now know that there are a couple of issues with the question and answer, that the author has willingly admitted this, and that SSC has an issue with the amount of time necessary for proof-reading what is, eventually, an informative bit of fun.

    However, does no-one see the irony with the posting of "why wasn't this QOTD proof-read" several pages after the same issue was first raised? Obviously, this doesn't encompass everyone who's answered in this thread, but how can someone demand better proof-reading if they themselves don't bother reading the preceding pages of the thread to see if their point has already been made?

    Personally, I expect that, when Steve comes online, the "wrong" answers will be amended to "right" answers. After all, he's been pretty good at resolving these issues before, so why should this be different?

    Semper in excretia, sumus solum profundum variat

  • majorbloodnock (6/24/2008)


    Well, I think we all now know that there are a couple of issues with the question and answer, that the author has willingly admitted this, and that SSC has an issue with the amount of time necessary for proof-reading what is, eventually, an informative bit of fun.

    However, does no-one see the irony with the posting of "why wasn't this QOTD proof-read" several pages after the same issue was first raised? Obviously, this doesn't encompass everyone who's answered in this thread, but how can someone demand better proof-reading if they themselves don't bother reading the preceding pages of the thread to see if their point has already been made?

    Personally, I expect that, when Steve comes online, the "wrong" answers will be amended to "right" answers. After all, he's been pretty good at resolving these issues before, so why should this be different?

    I think people are simply repeating the point so that they are heard as well, and with more people saying the same thing, then something might be done about it. Also, they wanted to have their point from the post seeing as they didn't get the point from the QotD 😉

  • I don't doubt you're right, Skyline.

    OK, 17 pages, here we come 😉

    Semper in excretia, sumus solum profundum variat

  • I only have 6 pages here... not to say that showing 100 post on a page would even lower their number 😀

    ( just kidding 😉 )

    I'm faithful too that someone sooner or later will fix that horrible red cross and put the right green mark 🙂

    Have a nice day!

    PS: I re-read the answer that the author gave:

    In SQL Server T-SQL, by default, a query takes null as first when the order is ascending (the default). So we just give some value of greater date in order by so that it will come at last.

    That seems quite clear, he probably ticked solution #3 as correct by accident, as a matter of fact everything else leads in the right direction 🙂

Viewing 15 posts - 91 through 105 (of 138 total)

You must be logged in to reply to this topic. Login to reply