• WITH CTE (col1, col2, col3) AS

    (

    SELECT '1' col1,'abc' col2, 'bbc' col3 UNION ALL

    SELECT '2'col1,'nbc' col2, 'zhi' col3 UNION ALL

    SELECT '3'col1, NULL col2, 'abc' col3 UNION ALL

    SELECT '4'col1, 'gef' col2, NULL col3 UNION ALL

    SELECT '5'col1, NULL col2, NULL col3

    )

    SELECT *

    FROM CTE

    On this one, it should only show up row 2, 4 and 5. I want to keep if col2 or col3 is null but they need to be exluded if they have abc, def or ghi in them.