"if all items on the order are xyz, then extract" -- Please Help

  • How can I write a "if all items on the order are RTD, then extract" ?

    i.e. The following would report only "P0123459" one time

    ------------------------------------------------

    OrderNumber ItemNumber

    P0123423 124536-RTD

    P0123423 12412-RTD

    P0123423 12127-RTD

    P0123423 12124-xgt

    P0123459 124536-RTD

    P0123459 12412-RTD

    P0123459 12127-RTD

    P0123459 12124-RTD

  • Something like this?

    select distinct a.ordernumber

    from tblorder a

    where a.ordernumber not in

    (select distinct b.ordernumber

    from tblorder b

    where right(b.itemnumber,3) 'rtd')


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

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