I wrote a query that does an inner join of two subqueries. The first subquery has an alias of "SRC" and the other has an alias of "DEST". What I want to do is update some fields in the table NomineeActionLegislatorVoteDetail (part of DEST subquery) with values from the table Nominee_Committee_Vote (part of SRC subquery). It souds easy but I just cannot figure out how to do it. Does anyone have any suggestions? Any help would be appreciated.
Here is the query I wrote:
select * 
from (
    select  ncv.*,
        na.NomineeActionId,
        l.LegislatorId
    from ongoing..Nominee_Committee_Vote ncv
    inner join azleg..NomineeAction na on
        ncv.session_id    = na.x_session_id   and
        ncv.committee_id  = na.x_committee_id and
        ncv.agency_id     = na.x_agency_id    and
        ncv.position_id   = na.x_position_id  and
        ncv.nominee_id    = na.x_nominee_id   and
        ncv.received_date = na.x_received_date
    inner join status..session s on
        ncv.session_id    = s.session_id
    inner join azleg..Legislator l on
        ncv.member_id     = l.x_member_id     and
        s.legislature     = l.LegislatureId
) SRC
inner join (
    select votedetail.*
    from azleg..NomineeActionLegislatorVoteDetail votedetail
    inner join azleg..NomineeAction nom_action on
        votedetail.NomineeActionId = nom_action.NomineeActionId
) DEST on
    SRC.agency_id     = DEST.x_agency_id     and
    SRC.position_id   = DEST.x_position_id   and
    SRC.nominee_id    = DEST.x_nominee_id    and
    SRC.received_date = DEST.x_received_date and
    SRC.session_id    = DEST.x_session_id    and
    SRC.committee_id  = DEST.x_committee_id  and
    SRC.member_id     = DEST.x_member_id
where   SRC.NomineeActionId <> DEST.NomineeActionId
   OR   SRC.LegislatorId <> DEST.LegislatorId
   OR   SRC.Vote <> DEST.Vote
 
     
    