• Following query worked for me:

    with prod as

    (

    select distinct ShipmentID From Shipment

    where Producttypeid <> 2

    )

    select DISTINCT ShipmentID From Shipment h

    LEFT OUTER join prod p on h.ShipmentID = p.ShipmentID

    where P.ShipmentID IS NULL

    Thanks.

    Gunjan.