[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1363
  • Last Modified:

update from joined table?

The below code returns the following rs:

select C.uniquekey,c.TotalNumAttempts, S.uniqueid, s.tel,s.callcount
from campaign c
      inner join results_end s on C.uniquekey=S.uniqueid
where c.uniquekey=620607


C.uniquekey     TotalNumAttempts        uniqueid    s.tel                 callcount
620607            NULL                           620607      01153454017    8


How would I copy the callcount to totalnumattemps?



0
XanderP
Asked:
XanderP
4 Solutions
 
Atlanta_MikeCommented:
update campaign
    set TotalNumAttempts = s.callcount
from campaign c
     inner join results_end s
      on C.uniquekey=S.uniqueid
where c.uniquekey=620607
0
 
rafranciscoCommented:
Try this:

UPDATE C
SET TotalNumAttempts = S.CallCount
FROM campaign c inner join results_end s on C.uniquekey=S.uniqueid
where c.uniquekey=620607
0
 
devsolnsCommented:
insert into totalnumattemps (column name you want to insert it into here)
select s.callcount
from campaign c
     inner join results_end s on C.uniquekey=S.uniqueid
where c.uniquekey=620607
0
 
LowfatspreadCommented:
what do you mean by copy?

for display?
select C.uniquekey,coalesce(c.TotalNumAttempts,s.callout) as Attempts, S.uniqueid, s.tel,s.callcount
  from campaign c
  inner join results_end s
     on C.uniquekey=S.uniqueid
where c.uniquekey=620607

0
 
Atlanta_MikeCommented:
I assume you want to update the TotalNumAttempts in campaign from results_end.callcount?
0

Featured Post

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now