Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
Database Servers
DB2InformixIngresMS SQLOraclePervasive.SQLPostgreSQLProgressSybase
Desktop Databases
FileMakerFoxProMS AccessParadox
General
General DB TopicsDatabase Theory
Related Topics
Java Development.NET DevelopmentVB DevelopmentMore Topics ...

Database Forum / DB2 Topics / September 2008

Tip: Looking for answers? Try searching our database.

How update only nomatch

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
lenygold - 27 Sep 2008 02:14 GMT
Hello everybody!
I have 2 tables:
OLD_FAMILY

SSN                NAME
-----------------   -------------------
777777777 OLEG SMOLKIN                    
 888888888 ALEX ORLOV                      
 999999999 GREG BERG  

NEW_FAMILY

SSN                NAME
-----------------   -------------------
 777777777 OLEG SMOLKIN                    
 888888888 ALEX ORLOV                      
 999999999 MARK BERG  

I want update name in new_table only when names nomacth (SSN - 999999999)

UPDATE NEW_FAMILY N
SET NAME = (SELECT A.NAME FROM OLD_FAMILY A
                       JOIN NEW_FAMILY
                          ON N.SSN = A.SSN
                          AND N.NAME<> A.NAME);
But i got an error
sqlcode: -811
SQL0811N  The result of a scalar fullselect, SELECT INTO statement, or VALUES
INTO statement is more than one row.
Thank's in advance.
lenygold - 27 Sep 2008 02:57 GMT
Never mind i found the solution:
Update NEW_FAMILY as a
set NAME =
   (select NAME from OLD_FAMILY as b
      where b.SSN   = a.SSN
      and   b.NAME <> a.NAME)
  where exists
   (select * from OLD_FAMILY as b
      where b.SSN  = a.SSN
      and   b.NAME <> a.NAME);

>Hello everybody!
>I have 2 tables:
[quoted text clipped - 26 lines]
>INTO statement is more than one row.
>Thank's in advance.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2010 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.