troubleshooting Question

SQL syntax... Update statement from select?

Avatar of BILL Carlisle
BILL CarlisleFlag for United States of America asked on
Oracle DatabaseSQL
5 Comments2 Solutions1447 ViewsLast Modified:
Hi All,
I want to update a table with the results of a select. How do I do it?
I've got the Nurse and now I need to get the Nurse Supervisor and update the table that has the Nurse already.


UPDATE AUDIT_USE
set NURSE_SUPERV_ID = s.pid,
    NURSE_SUPERV = s.first_name||' '||s.last_name
where
 
select s.first_name,s.last_name, s.pid 
from AUDIT_USE u, PERSON p, person s
where p.pid = u.nurse_id
and s.position_id = p.REPORTS_TO_1 and s.INACTIVE='N'
and NURSE_ID is not null
and NURSE_ID != 999999999
and (NURSE_SUPERV_ID = 999999999 OR NURSE_SUPERV_ID is null)
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 2 Answers and 5 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros