Update Statement

  • Hi,

    I know this may be easy.. so dont laugh..

    But I want to add an update statement to below

    so it updates PROGRESS_NOTE.SUPERVISOR_MONIKER to '699005FE406B40C68B5A5A5DA0090171'

    ...

    Thanks

    Joe

    SELECT Provider.LName, Provider.FName, Provider.Code, USER_DEFINED_DATA.OID,

    USER_DEFINED_DATA.CAD750, Provider.OID, Provider.SupervisorLink,

    PROGRESS_NOTE.SUPERVISOR_MONIKER

    FROM PROGRESS_NOTE INNER JOIN Provider ON PROGRESS_NOTE.SUPERVISOR_MONIKER=Provider.OID

    INNER JOIN USER_DEFINED_DATA ON PROGRESS_NOTE.USER_DEFINED_DATA_MONIKER=USER_DEFINED_DATA.OID

    WHERE USER_DEFINED_DATA.CAD750='Draft'

    and (PROGRESS_NOTE.SUPERVISOR_MONIKER='65F415FE406B40C68B5A5A5DA1248171'

    or PROGRESS_NOTE.SUPERVISOR_MONIKER='622A2DD1462964FBEBEE859160FE72842')

    ORDER BY Provider.LName

  • I am not sure what you mean by "add to" but this should update the field to the value you specified

    UPDATE PROGRESS_NOTE

    SET PROGRESS_NOTE.SUPERVISOR_MONIKER = '699005FE406B40C68B5A5A5DA0090171'

    WHERE PROGRESS_NOTE.SUPERVISOR_MONIKER IN (

    '65F415FE406B40C68B5A5A5DA1248171',

    '622A2DD1462964FBEBEE859160FE72842' )

  • andersg98 (2/22/2012)


    I am not sure what you mean by "add to" but this should update the field to the value you specified

    UPDATE PROGRESS_NOTE

    SET PROGRESS_NOTE.SUPERVISOR_MONIKER = '699005FE406B40C68B5A5A5DA0090171'

    WHERE PROGRESS_NOTE.SUPERVISOR_MONIKER IN (

    '65F415FE406B40C68B5A5A5DA1248171',

    '622A2DD1462964FBEBEE859160FE72842' )

    Huh? You missed a very important condition by skipping the join and the where.

    UPDATE PROGRESS_NOTE

    SET SUPERVISOR_MONIKER = '699005FE406B40C68B5A5A5DA0090171'

    FROM PROGRESS_NOTE pn

    INNER JOIN Provider p

    ON pn.SUPERVISOR_MONIKER=p.Provider.OID

    INNER JOIN USER_DEFINED_DATA ud

    ON pn.USER_DEFINED_DATA_MONIKER=ud.OID

    WHERE ud.CAD750='Draft'

    and (pn.SUPERVISOR_MONIKER='65F415FE406B40C68B5A5A5DA1248171'

    or pn.SUPERVISOR_MONIKER='622A2DD1462964FBEBEE859160FE72842')

    Will this work for you?

    Jared
    CE - Microsoft

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

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