• skizzly (9/18/2012)


    Hi All,

    new here so be kind....:)

    I have a task to identify all students in a dataset of 49K that have multiple open attendances at schools.

    I can pull all students that have multiple open attendances and produce a list of these:

    SELECT studentID

    FROM step1 [ step1 identifies all student with open attendances ]

    GROUP BY studentID

    HAVING (COUNT(*) > 1)

    The help i need is how to then enable end user to specify a particular school and return all students with open attendance at that specified school AND show the other schools the student has a linked open attendance with.

    Example:

    studentID, schoolID

    1 2

    1 3

    2 3

    3 4

    4 5

    user selects schoolID of 3, then returned set would show:

    schoolId, studentId

    3 1

    2 1

    Thanks very much for any help that can be passed my way!

    Your output is confusing.For school id 3 there are two students.

    --rhythmk
    ------------------------------------------------------------------
    To post your question use below link

    https://www.sqlservercentral.com/articles/forum-etiquette-how-to-post-datacode-on-a-forum-to-get-the-best-help
    🙂