query help

  • How do i write query that shows me data for one hospital.

    My input looks like

    hospital_nametable_namedatarid

    00086Registratiejaar20071

    00382Registratiejaar20082

    00382Ziekenhuis003823

    00086Ziekenhuis000864

    00382Aantal gelezen records Number of records read 5

    00086Aantal gelezen records Number of records read 6

    00382DROPOSL488817

    00086DROPOSL48

    00382DRVAWPE98309

    00086DRVAWPE710

    00382DRDIAGN13944711

    00086DRDIAGN3312

    00382DRVERRI3948113

    00086DRVERRI2314

    -----------------15

    00086Aantal geschreven records Number of records written16

    00382Aantal geschreven records Number of records written17

    00086DE2BEHPAT418

    00382DE2BEHPAT4888119

    00086DE3ZORGTR420

    00382DE3ZORGTR4888121

    00086DE4ZORGTRSPME622

    00382DE4ZORGTRSPME934123

    00086DE5DIAG3324

    00086DE6VERR2325

    My output shud have data like for one Ziekenhuis = 00086

    Registratiejaar2007

    Ziekenhuis00086

    Aantal gelezen records Number of records read

    DROPOSL4

    DRVAWPE7

    DRDIAGN33

    DRVERRI23

    Aantal geschreven records Number of records written

    DE2 BEHPAT4

    DE3 ZORGTR4

    DE4 ZORGTR SPME6

    DE5 DIAG33

    DE6 VERR23

    --2 for other Ziekenhuis = 00382

    Registratiejaar2008

    Ziekenhuis00382

    Aantal gelezen records Number of records read

    DROPOSL48881

    DRVAWPE9830

    DRDIAGN139447

    DRVERRI39481

    Aantal geschreven records Number of records written

    DE2 BEHPAT48881

    DE3 ZORGTR48881

    DE4 ZORGTR SPME9341

    DE5 DIAG

    DE6 VERR

  • khushbu (8/10/2010)


    How do i write query that shows me data for one hospital.

    My input looks like

    hospital_nametable_namedatarid

    00086Registratiejaar20071

    00382Registratiejaar20082

    Please provide table creation scripts and sample data as in the link below. Without this, any suggestion would be exactly that - a suggestion, a best guess.

    “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 2 posts - 1 through 2 (of 2 total)

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