• Yggaz (12/21/2012)


    There is just one variant of one aggregate function that DOES take nulls into account: COUNT(*).

    However, it is uncompatible with DISTINCT clause.

    SELECT COUNT(col1) as cnt_col1

    , COUNT(*) as cnt_asterisk

    FROM #testAggregates

    (8, 10)

    I do not agree with this. COUNT(*) only considers counting the number of rows. It does not even bother to take a look at the columns and there values. Hence COUNT(*) is not the variant.

    ~ Lokesh Vij


    Guidelines for quicker answers on T-SQL question[/url]
    Guidelines for answers on Performance questions

    Link to my Blog Post --> www.SQLPathy.com[/url]

    Follow me @Twitter