• There is an easier way to do it. Using the COUNT(ColumnName) function counts only those rows that aren't null.

    Here's an example:

    create table #Orders (

    OrderNum int,

    LineNum int,

    Product varchar(10),

    Result varchar(25)

    )

    ;

    insert into #Orders

    select 1,1,'ABC',null union all

    select 1,2,'XYZ','Requires Review' union all

    select 2,1,'Foobar',null union all

    select 2,2,'Id10t',null union all

    select 3,1, 'ABC', 'Not Null' union all

    select 3,2, 'DEF', 'Not Null'

    ;

    -- Get the orders where all Result is null

    SELECT OrderNum

    FROM #Orders

    GROUP BY OrderNum

    HAVING COUNT(Result) = 0

    -- You can also get all of the orders that don't

    -- have any nulls in Result

    SELECT OrderNum

    FROM #Orders

    GROUP BY OrderNum

    HAVING COUNT(*) - COUNT(Result) = 0

    Todd Fifield