Take off matching invoice from list

  • I am create a new report .

    How to take off code "AS1003" and them take off John from list and keep Peter on my list.

    1st appointment assessement Name: John Code: AS1001

    2nd appointment reveiew Name: John Code: AS1002

    3rd appointment treatment Name: John Code: AS1003

    1st appointment assessement Name: Peter Code: AS1001

    2nd appointment reveiew Name: Peter Code: AS1002

    Lakh

  • What did you try and what is wrong with those results?

  • I have try to used "not like" it only void the 3rd line but i need to void everything for John.

    lakh

  • Please post the actual code, it's eaiser for us to help that way.

  • namePHC_ID Contact DateReferral Dateactivity__2

    John22/15729 14-Mar-0602-Feb-06SS70

    John22/15729 24-Jul-0602-Feb-06SS78

    John22/15729 21-Aug-0602-Feb-06AS0630

    John22/15729 25-Aug-0602-Feb-06SS71

    John22/15729 01-Sep-0602-Feb-06SS76

    John22/15729 21-Nov-0602-Feb-06SS74

    Peter23/13278 18-Nov-0824-May-07SS90

    Peter23/13278 07-Jun-0724-May-07SS76

    Peter23/13278 28-Jun-0724-May-07SS76

    Peter23/13278 02-Aug-0724-May-07SS76

    Peter23/13278 22-Apr-0824-May-07SS78

    Peter23/13278 06-May-0824-May-07SS78

    Peter23/13278 15-Oct-0824-May-07SS78

    Peter23/13278 01-Dec-0824-May-07D41

    I need to take off code: AS0630 for John and only keep Peter record on my list.

  • Thanks, but I meant the query you are using ;).

  • SELECT dbo_pod_surgery.name, dbo_pod_surgery.PHC_ID, dbo_pod_surgery.[Contact Date], dbo_pod_surgery.[Referral Date], dbo_pod_surgery.activity__2,

    FROM dbo_pod_surgery

    WHERE (((dbo_pod_surgery.PHC_ID)="22/15729" Or (dbo_pod_surgery.PHC_ID)="23/13278"));

    Thanks

    Lakh

  • SELECT dbo_pod_surgery.name, dbo_pod_surgery.PHC_ID, dbo_pod_surgery.[Contact Date], dbo_pod_surgery.[Referral Date], dbo_pod_surgery.activity__2

    FROM dbo_pod_surgery

    WHERE (((dbo_pod_surgery.PHC_ID)="22/15729" Or (dbo_pod_surgery.PHC_ID)="23/13278")

    AND dbo_pod_surgery.PHC_ID NOT IN (Select dbo_pod_surgery.PHC_ID FROM dbo_pod_surgery

    WHERE dbo_pod_surgery.activity__2 = "AS0630")

    );

  • Many Thanks

    Lakh

  • SELECT s.name, s.PHC_ID, s.[Contact Date], s.[Referral Date], s.activity__2

    FROM dbo_pod_surgery s

    WHERE s.PHC_ID IN ('22/15729', '23/13278')

    AND s.activity__2 <> 'AS0630'

    “Write the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.” - Gail Shaw

    For fast, accurate and documented assistance in answering your questions, please read this article.
    Understanding and using APPLY, (I) and (II) Paul White
    Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden

Viewing 10 posts - 1 through 9 (of 9 total)

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