• dramaqueen (10/25/2016)


    Hi,

    I am having issues with the following script. I have 3 tables that link together.

    What I need to do is find owners that have items with statuses as 7 and (1-15).

    SELECT O.OW_ID

    , O.OW_TITLE

    , O.OW_FORENAMES

    , O.OW_SURNAME

    , COUNT(*)

    FROM PROPS.DP_OWNER O

    JOIN PROPS.DP_ENTRY E

    ON O.OW_ID = E.DP_PERSON

    JOIN PROPS.DP_ITEM I

    ON E.DP_ID = I.DPI_DP_ID

    WHERE I.DPI_STATUS IN ('7') --DISPOSED

    -- I was thinking something might go here to say and?

    GROUP BY O.OW_ID

    , O.OW_TITLE

    , O.OW_FORENAMES

    , O.OW_SURNAME

    Thanks in advance for any help!!

    Paul

    Change this line

    WHERE I.DPI_STATUS IN ('7') --DISPOSED

    to this?

    WHERE I.DPI_STATUS IN ('7', '(1-15)')

    If that's not what you meant, please try to make your requirement clearer, so that someone who is not familiar with your data can understand.

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.