Skip to content

base.episode_lf_entries #1

Open

Description

@oieeri26

There are around 100 child ids that have two records. When comparing the records base.rptPlacement and base.rptPlacement_Events it appeared that the ids we compared only had one adoption, not two.

Activity

  1. gregorp commented on May 7, 2015

    @gregorp

    It'd be nice to supplement this with a query to illustrate the problem... 2 months later I'm having trouble remembering exactly what this is.

  2. oieeri26 commented on May 7, 2015

    @oieeri26
    ContributorAuthor

    In the base.episode_lf_entries table we have roughly 100 ids that suggest that the child had multiple adoptions, here's the query to find the duplicates.

    SELECT 
        id.id_prsn_child
        ,e.discharge_type
        ,e.state_fiscal_yyyy
    FROM 
        (SELECT 
            id_prsn_child
            ,COUNT(id_prsn_child) AS count
        FROM base.episode_lf_entries
        GROUP BY id_prsn_child
        HAVING COUNT(id_prsn_child) > 1) AS id
    LEFT JOIN base.episode_lf_entries AS e
        ON id.id_prsn_child = e.id_prsn_child
    WHERE discharge_type = 'adoption'
    ORDER BY id.id_prsn_child

    When I checked the ids against base.rptPlacement_Events, using the query below, it appears that most of these children have not had multiple adoptions.

    SELECT 
        *
    FROM 
        (SELECT 
            id_prsn_child
            ,COUNT(id_prsn_child) AS count
        FROM base.episode_lf_entries
        GROUP BY id_prsn_child
        HAVING COUNT(id_prsn_child) > 1) AS id
    LEFT JOIN base.rptPlacement_Events AS pe
        ON id.id_prsn_child = pe.child
    WHERE tx_end_rsn = 'adoption'
    ORDER BY pe.child
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions