Updating data from one table to another
Next, build the query like the one below: This query will update the MFG field in the Bot table with the value in the MFG field in the Big table when the PART values match.
Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
It is simple enough to do so record by record but can I do so using something similar to the INSERT INTO ...
SELECT type of query that does everything in one go?
I am using Table T1 to insert or update the data inthe Table T2 (which has a unique key column -c1 c2) in oracle 8.1.7. COM merge into t1 2 using t2 3 on ( t2.object_id = t1.object_id ) 4 when matched then 5 update set t1.object_name = t2.object_name 6 when not matched then 7 insert (object_id, object_name) values( t2.object_id, t2.object_name); 29317 rows merged. In my case Table T1 (staging table with 300 columns) will have 200 thousand rows every day for insert or update to thehistory table T2 ( 280 columns) that has 10 Million historical rows. May 10, 2004 - pm UTC nologging is not a hint.nologging will *never* be useful for an do realize your update sets a.mid_table_id to either: a) itself (you selected a.mid_table_id again) b) null if nothing exists in bprobably *not* what you meant?
You can select multiple tables by holding down the Update Query from the popup menu.
I put a primary key on B(id) because if there is NO SUCH constraint -- the update is totally ambigous -- if there is more then 1 value of B1 in B for a given ID -- we cannot tell what row in B should be used to update the row in A. dear sir , Acually my problem is huge that that simple , i just try to give u a sample of my problem.i just need to know the best way to update some column value that depends on other columns value in same table (or /and ) in other tables .specially when one of them is a date.i do made a script that run every day at 5 am. March 21, 2004 - pm UTC they are derived columns and should not be stored -- especially something like "20 years old flag" as that can change at any is, and will remain, my answer unless you give me a real world scenario that would demand otherwise (the 20 year old flag should NOT be stored, period) Hi I have three tables, A, B and CA is parent of B and C, A has a composite PK deptno and dname I would like to know if following delete SQLs are equivalent1.------------------------------------------delete bwhere(deptno, dept_name) in (select a.deptno, dname from a, c where a.deptno = c.deptno and a.dname = c.dept_name);2.-----------------------------------------delete bwheredeptno = (select a.deptno from a, c where a.deptno = c.deptno and dname = dpt_name)and dept_name = (select a.dname from a, c where a.deptno = c.deptno and a.dname = c.dpt_name); Are they :-?
Given that, we can:[email protected] select * from a 2 / ID A1---------- ------------------------- 1 Hello 2 World The following updates are equivalent as well - they do the same thing differently. March 22, 2004 - am UTC hows about this -- you write out in english what each one does -- write the "specs" if you will that describe what each query does.
This works fine when I try to update all the records in tbl A, however, in this case I only have missing data which I have identified and populated in tbl B.
When I try to update only the missing data the non-matched data is also updated but to NULL. The reason some of your rows are getting NULLs updated is due to the subquery.