"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')

    The absence of evidence is not evidence of absence
    - Martin Rees
    The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
    - Phil Parkin

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

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