Oracle Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesOracle Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 6th, 2004, 03:07 PM
drb drb is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 2 drb User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
update from inout table to output table

I want to update as:

update outputtable set outputtable.date = Intputtable.date where outputtable.filed1=inputtable.field1 AND outputtable.filed2=inputtable.field2 AND outputtable.filed3=inputtable.field3
This select below gives the records I want to match for update:

SELECT b.date FROM outputtable b,inputtable a WHERE a.filed1=b.filed1 AND a.filed2=b.filed2 AND a.filed3=b.filed3

this select fetches 90 records correctly. I want update b.date with a.date, for this can you please suggest update query?

Please note field1,field2 and field3 of inputtable is unique.
Please help
thanks

Reply With Quote
  #2  
Old November 7th, 2004, 09:17 AM
swampBoogie swampBoogie is offline
Contributing User
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Jan 2003
Location: Paris Uppland
Posts: 1,784 swampBoogie User rank is Sergeant Major (2000 - 5000 Reputation Level)swampBoogie User rank is Sergeant Major (2000 - 5000 Reputation Level)swampBoogie User rank is Sergeant Major (2000 - 5000 Reputation Level)swampBoogie User rank is Sergeant Major (2000 - 5000 Reputation Level)swampBoogie User rank is Sergeant Major (2000 - 5000 Reputation Level)swampBoogie User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 2 Weeks 4 Days 21 h 42 m 49 sec
Reputation Power: 37
Code:
update outputtable 
set outputtable.date = (select Intputtable.date 
from inputtable 
where outputtable.filed1=inputtable.field1 
AND outputtable.filed2=inputtable.field2 
AND outputtable.filed3=inputtable.field3)
where (filed1,filed2,filed3) in 
   (select field1,field2,field3
       from inputtable)

Reply With Quote
  #3  
Old November 7th, 2004, 06:26 PM
drb drb is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 2 drb User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
SQL update reply

Thank you for your reply, it is great and gives exact records that it updates. But before I commit this update , is there any way to check the records that are being updated? please help
Thank you

Quote:
Originally Posted by swampBoogie
Code:
update outputtable 
set outputtable.date = (select Intputtable.date 
from inputtable 
where outputtable.filed1=inputtable.field1 
AND outputtable.filed2=inputtable.field2 
AND outputtable.filed3=inputtable.field3)
where (filed1,filed2,filed3) in 
   (select field1,field2,field3
       from inputtable)

Reply With Quote
  #4  
Old November 8th, 2004, 02:53 AM
swampBoogie swampBoogie is offline
Contributing User
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Jan 2003
Location: Paris Uppland
Posts: 1,784 swampBoogie User rank is Sergeant Major (2000 - 5000 Reputation Level)swampBoogie User rank is Sergeant Major (2000 - 5000 Reputation Level)swampBoogie User rank is Sergeant Major (2000 - 5000 Reputation Level)swampBoogie User rank is Sergeant Major (2000 - 5000 Reputation Level)swampBoogie User rank is Sergeant Major (2000 - 5000 Reputation Level)swampBoogie User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 2 Weeks 4 Days 21 h 42 m 49 sec
Reputation Power: 37
What do you mean by check the updated rows?

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesOracle Development > update from inout table to output table


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT