|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Today @ 3:03 PM
Points: 5,244,
Visits: 7,061
|
|
|
|
|
|
Old Hand
      
Group: General Forum Members
Last Login: Tuesday, May 21, 2013 9:40 PM
Points: 326,
Visits: 472
|
|
|
|
|
|
SSCommitted
      
Group: General Forum Members
Last Login: Friday, May 17, 2013 2:53 AM
Points: 1,530,
Visits: 359
|
|
thanks for this wonderful question...
|
|
|
|
|
Old Hand
      
Group: General Forum Members
Last Login: 2 days ago @ 8:38 PM
Points: 322,
Visits: 477
|
|
Nice. Helps if I remember that 6 > 5
|
|
|
|
|
SSC-Addicted
      
Group: General Forum Members
Last Login: Thursday, January 05, 2012 2:05 AM
Points: 488,
Visits: 335
|
|
|
|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Today @ 3:03 PM
Points: 5,244,
Visits: 7,061
|
|
Toby Harman (8/30/2010)
Nice. Helps if I remember that 6 > 5 
I feel your pain. I managed to miss the point as well - on my own question!  Thanks everyone for the nice words!
For those who want to see for themselves, or try playing around with the issue, here is some repro code:
CREATE TABLE #QotD (Col1 int, Col2 int); go INSERT INTO #QotD (Col1, Col2) SELECT 1, 1 UNION ALL SELECT 1, 2 UNION ALL SELECT 1, 3 UNION ALL SELECT 2, 4 UNION ALL SELECT 2, 5 UNION ALL SELECT 2, 6; go SELECT COUNT(*) FROM #QotD WHERE Col2 <> 4 HAVING MAX(Col2) < 5; go DROP TABLE #QotD; go
Hugo Kornelis, SQL Server MVP Visit my SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis
|
|
|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Thursday, April 25, 2013 7:59 AM
Points: 103,
Visits: 410
|
|
Very good question.. I missed my points but learnt something new today..
|
|
|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Thursday, April 11, 2013 12:58 AM
Points: 174,
Visits: 555
|
|
Another good one. I have been losing points lately but I don't miss them.
{Sorry, I meant I was losing, not getting, points lately but its alright. Now I hope to remember if I get an SQL gotcha in work for possible QOTD. }
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Today @ 7:27 AM
Points: 1,259,
Visits: 4,260
|
|
| I was expecting an answer of 3 or 5, but I wasn't sure which, so I created a temporary table to check--was somewhat surprised to see no rows at all returned, but now Hugo has explained the answer I see the logic.
|
|
|
|
|
SSChasing Mays
      
Group: General Forum Members
Last Login: Today @ 10:36 AM
Points: 651,
Visits: 688
|
|
Great question. I was torn between the correct answer and the single record returning 0... I don't mind having gotten it wrong. 
ron
----- a haiku...
NULL is not zero NULL is not an empty string NULL is the unknown
|
|
|
|