If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Update Syntax

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-18-07, 16:23
Quigley007 Quigley007 is offline
Registered User
 
Join Date: Dec 2004
Location: MN, USA
Posts: 4
Update Syntax

Hi,

I have an update question: Using DB2 UDB v8, FP9a.

I have a tables that look like this:

IP Host LastIP
--- ---- -------
001 BM1 003
002 BM2 003
003 BM3 002

I need to update LastIP so it equal to the value of Host when comparing Host to IP. So I need it to look like this after the update:

IP Host LastIP
--- ---- -------
001 BM1 BM3
002 BM2 BM3
003 BM3 BM2

I am getting stuck on the sql.

Thanks if you can help or point me in the right direction!
Reply With Quote
  #2 (permalink)  
Old 07-18-07, 16:32
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
update mytable as m set lastip = (select host from mytable as x where x.ip = m.lastip)

Andy
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On