Using PIVOT

  • aliahad

    Valued Member

    Points: 62

    I need to know how can I use PIVOT , my query

    SELECT 
    A.HIS_STD_OID,
    B.HIM_SERIES_ID

    FROM
    il_cps_conversion.dbo.HEALTH_IMMUNIZATION_SERIES A
    INNER JOIN il_cps_conversion.dbo.HEALTH_IMMUNIZATION_DEFINITION B
    ON A.HIS_HIM_OID = B.HIM_OID
    WHERE
    1=1
    --AND STDNT.STD_OID = A.HIS_STD_OID
    AND A.HIS_FIELDB_001 = '0'
    AND A.HIS_STD_OID = 'std01000001256'
    AND B.HIM_SERIES_ID <> 'TD'

    returns following data set with six rows

    and I need one row with all the six series_id . Like below:

    std01000001256: DTP, MMR, MUM, RUB, TDP, VAR

    Any suggestion will help.

     

  • frederico_fonseca

    SSChampion

    Points: 14060

    cross post from another forum https://www.tek-tips.com/viewthread.cfm?qid=1794041 - reply posted there.

Viewing 2 posts - 1 through 2 (of 2 total)

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