Solved

Update statement on inner join

Posted on 2014-02-06
6
410 Views
Last Modified: 2014-02-06
Can someone help with this? i am getting 00871 missing SET keyword

UPDATE CREDIT_DETAIL INNER JOIN CREDIT_HEADER ON CREDIT_HEADER.CID = CREDIT_DETAIL.CID
SET ITMPRC = 2.59 
WHERE CREDIT_HEADER.CUSTOMER = 26187 AND  CREDIT_HEADER.CHAIN = 0 AND CREDIT_DETAIL.ITEM = 60200 
;

Open in new window

0
Comment
Question by:FutureDBA-
  • 3
  • 2
6 Comments
 
LVL 73

Expert Comment

by:sdstuber
ID: 39840353
what is the update supposed to be doing?
0
 
LVL 73

Accepted Solution

by:
sdstuber earned 500 total points
ID: 39840357
assuming you're trying to update the details for a certain subset of headers

try this..


UPDATE credit_detail
   SET itmprc = 2.59
 WHERE EXISTS
           (SELECT NULL
              FROM credit_header
             WHERE credit_header.customer = 26187
               AND credit_header.chain = 0
               AND credit_detail.item = 60200
               AND credit_header.cid = credit_detail.cid);
0
 

Author Comment

by:FutureDBA-
ID: 39840358
I want to update ITMPRC on credit_detail where credit_header customers and chain match a variable in a where clause, linking the 2 cia their primary keys "cid" on each table
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 73

Expert Comment

by:sdstuber
ID: 39840361
do you mean like I did in my second post?
0
 
LVL 22

Expert Comment

by:Steve Wales
ID: 39840363
You may want to see if this article helps you with what you're trying to do:

http://www.experts-exchange.com/Database/Miscellaneous/A_1517-UPDATES-with-JOIN-for-everybody.html

It covers Oracle, SQL Server and MySQL but gives 3 different ways of performing an update with Join in Oracle.
0
 

Author Closing Comment

by:FutureDBA-
ID: 39840984
Worked perfectly.  Thanks
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Truncate is a DDL Command where as Delete is a DML Command. Both will delete data from table, but what is the difference between these below statements truncate table <table_name> ?? delete from <table_name> ?? The first command cannot be …
Working with Network Access Control Lists in Oracle 11g (part 2) Part 1: http://www.e-e.com/A_8429.html Previously, I introduced the basics of network ACL's including how to create, delete and modify entries to allow and deny access.  For many…
This video shows setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines
Via a live example, show how to take different types of Oracle backups using RMAN.

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now