Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase ««12345»»»

Sort Order - Include Null al last Expand / Collapse
Author
Message
Posted Monday, June 23, 2008 12:24 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Friday, March 28, 2014 5:06 AM
Points: 1,204, Visits: 915
As far as I know, if you use isnull then the field, when null will take the value presented in the isnull, that means that question 2 must be right. Heck, can 98% people have it wrong. Shucks.........

Manie Verster
Developer
Johannesburg
South Africa

I can do all things through Christ who strengthens me. - Holy Bible
I am a man of fixed and unbending principles, the first of which is to be flexible at all times. - Everett Mckinley Dirkson (Well, I am trying. - Manie Verster)
Post #521545
Posted Monday, June 23, 2008 12:51 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Monday, November 25, 2013 12:09 AM
Points: 2,388, Visits: 32
I made the right choice that is #2 but it says that I'm wrong??
Please correct it please.
Post #521548
Posted Monday, June 23, 2008 1:43 AM


SSCarpal Tunnel

SSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal Tunnel

Group: General Forum Members
Last Login: Today @ 8:32 AM
Points: 4,913, Visits: 8,625
Really funny! I've been a member since 2002 and I've never answered qod before: I answered two questions in the last ten days and both were wrong!

There's something wrong with me, maybe...


--
Gianluca Sartori

Get your two-cent-answer quickly
spaghettidba.com
@spaghettidba
Post #521568
Posted Monday, June 23, 2008 1:58 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Wednesday, June 08, 2011 12:54 PM
Points: 29, Visits: 32
I also chose option 2 and was told that it's not correct.

It seems that the "answer" is both options 2 and 3, which is incorrect. option 3 does not result in the sample output given the sample input.

According to the explanation of the answer only option 2 is correct.

This is my first time answering a question of the day, but clearly there seems to be something wrong here. What's going on with this question?
Post #521574
Posted Monday, June 23, 2008 2:26 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Wednesday, July 13, 2011 2:21 AM
Points: 251, Visits: 208
:D

Seems the author fell into the trap the question was trying to highlight. Only option 2 gives the required result!!
Post #521580
Posted Monday, June 23, 2008 2:56 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Thursday, March 20, 2014 4:03 AM
Points: 1,396, Visits: 549
I selected option 2 (and only option 2) and was told I was wrong, as I needed to select option 2 & 3. However option 3 returns the results in the following order:


EmpName DateOfLeaving
dcd 2000-08-10 00:00:00.000
abc 1999-10-10 00:00:00.000
bcd 1998-11-11 00:00:00.000
ccd NULL
eed NULL


and the question stated that the solution should be:


EmpName DateOfLeaving
Bcd 11 Nov 1998
Abc 10 Oct 1999
Dcd 10 Aug 2000
Ccd null
Eed null


Therefore I guess thtat the question is worng. At least I should get a point for writing this reply! :P


Regards,

Phil
Post #521589
Posted Monday, June 23, 2008 3:02 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Tuesday, February 18, 2014 7:14 AM
Points: 1,344, Visits: 1,983
Glad to see I'm not alone in deciding immediately that answer #3 with DateOfLeaving DESC wouldn't put the dates in the right order so is definitely wrong, irrespective of where the NULLs come!

Derek
Post #521593
Posted Monday, June 23, 2008 3:12 AM
Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Today @ 8:03 AM
Points: 3,086, Visits: 1,145
Only option 2 gives result as shown in the question, but reading back the question, I get really confused if that even was what was asked.
The question is to have list off all employees with the employees with DateOfLeaving coming last

Doesn't this mean that employees without DateOfLeaving (the null values), should be first in the result set?!

Guess the only good solution is to give everybody their points :D
Post #521598
Posted Monday, June 23, 2008 3:24 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Thursday, January 08, 2009 1:32 AM
Points: 129, Visits: 35
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

Maybe he wanted to say this?
The question is to have list off all employees with the employees without DateOfLeaving coming last and all others sorted ascending order of date of leaving


Anyway the two answers which they say being correct have different results, so at least one of them is wrong... #3 in my opinion is wrong and I was very surprised of it when I was told that #2 alone was not correct ;)
Post #521603
Posted Monday, June 23, 2008 3:46 AM
SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Thursday, March 20, 2014 7:32 AM
Points: 5,191, Visits: 1,368
Another controversial question, where you tend to lose points though u know the answer....


Post #521611
« Prev Topic | Next Topic »

Add to briefcase ««12345»»»

Permissions Expand / Collapse