Retrieve Records with NOT NULL

  • Hi All,

    I have a OrderDetails Table with SINumber as Column in it.

    ID is Identity field in the OrderDetails table.

    So new ID for each item with same order number as given below

    Order Details Table

    ID - OrderNumber - ItemCode - SINumber

    1 - 122 - 1 - 223

    2 - 122 - 2 - 224

    3 - 122 - 3 - NULL

    4 - 123 - 4 - NULL

    5 - 124 - 2 - NULL

    6 - 124 - 4 - 228

    7 - 125 - 3 - NULL

    8 - 125 - 5 - NULL

    9 - 125 - 6 - NULL

    From this table i have to get the OrderNumber which has all the SINumber value as NULL

    Need help to do this, thanks in advance. and if i'm not clear please notify me.

    Thanks

    Prakash

  • SELECT OrderNumber

    FROM OrderDetails

    GROUP BY OrderNumber

    HAVING COUNT(SINumber)=0

    ____________________________________________________

    Deja View - The strange feeling that somewhere, sometime you've optimised this query before

    How to get the best help on a forum

    http://www.sqlservercentral.com/articles/Best+Practices/61537
  • Thank U Mark, It Works Fine, Thanks for solving my problem in short period of time.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply