Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Update Query Required

Posted on 2011-02-24
9
Medium Priority
?
295 Views
Last Modified: 2012-05-11
I have two tables Table CLC(IMSI_NO,PUKK) and TABLE PUK(IMSI_NO , PUK1).

Need to update table CLC with PUk1 valueof Table PUK for values matching IMSI_NO in CLC and PUK
0
Comment
Question by:ratna1234
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 23

Accepted Solution

by:
Rajkumar Gs earned 1000 total points
ID: 34973141
UPDATE CLC
SET PUK.PUK1
FROM CLC INNER JOIN PUK ON CLC.IMSI_NO = PUK.IMSI_NO

Try this query
0
 
LVL 74

Expert Comment

by:sdstuber
ID: 34973172
udpate clc
set pukk = (select puk1 from puk where puk.imsi_no =cls.imsi_no)
0
 
LVL 74

Expert Comment

by:sdstuber
ID: 34973190
typo

update

not

udpate
0
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
LVL 41

Expert Comment

by:Sharath
ID: 34973211
try this.
UPDATE CLC c 
   SET c.PUKK = (SELECT p.PUK1 
                   FROM PUK p 
                  WHERE c.IMSI_NO = p.IMSI_NO)

Open in new window

0
 
LVL 41

Expert Comment

by:Sharath
ID: 34973223
didn't see sdstuber's post.
0
 
LVL 58

Assisted Solution

by:cyberkiwi
cyberkiwi earned 1000 total points
ID: 34973275
If the other table is like a staging that which will not fully match the records in CLC, then you need a WHERE clause, otherwise you will be emptying all values in CLC.PUKK for records not matched in PUK.

UPDATE CLC c 
   SET c.PUKK = (SELECT p.PUK1 
                   FROM PUK p 
                  WHERE c.IMSI_NO = p.IMSI_NO)
WHERE c.IMSI_NO IN
(
SELECT IMSI_NOFROM PUK
)

Open in new window

0
 
LVL 74

Expert Comment

by:sdstuber
ID: 35511722
http:#34973172  should have been accepted since it was first

0
 
LVL 41

Expert Comment

by:Sharath
ID: 35514292
I agree with sdstuber.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to Create User-Defined Aggregates in Oracle Before we begin creating these things, what are user-defined aggregates?  They are a feature introduced in Oracle 9i that allows a developer to create his or her own functions like "SUM", "AVG", and…
When it comes to protecting Oracle Database servers and systems, there are a ton of myths out there. Here are the most common.
This video explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.

722 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