will be slow, but this is the only data I have to match them together. I could create a third table for the merged results, if that would be faster? However, I prefer 'JOIN' syntax for joins rather than multiple 'WHERE' conditions.I tried My SQL - How can I update a table with values from another table? I think its easier to read If its running slow how large are the tables? For an example have a read of this tutorial: answer ( from stackoverflow also provides a good example.I have a database with account numbers and card numbers.= t1.original System Name ) In order to get accurate solutions, could you please provide a few rows of sample data before and after the update (also include at least one row that you do not want updated).Solving word problems is fun, but it leads to a lot of wasted effort [email protected] Bertrand - sorry about that. Some of my questions get wordy so I try to be specific as possible. You specifically have helped me a couple of times in the [email protected] Bertrand - I wasn't sure how to provide the sample data.
The solution was indeed to add the required column to the first select, and then make all other selects refer to it e.g.it depends what is a use of those tables , but you might consider putting trigger on original table on insert and update and when insert or update is done update second table based on only one item from original table , it will be quicker.I have a form that displays a list of systems along with their current status.Additionally -- given the way the where and set clauses are CODED in the above -- it would succeed. The Headoffice is merge the data into their system. For migration data first of all i create another temporary user named VISTEMP then cotinuing this kinds of code insert into VISTEMP. Now we can update the join: update ( select a.pop, from taba a, gtt b where = ) set pop = cnt / and thats it. Hi Tom, Im selecting approximately 1 million records from some tables and populating another set of tables.The query would in fact execute without any error messages since the correlated subquery in SET clause returns EXACTLY one row for each row in B and the where clause executes without error. Lets say you have a table A ( id int, a1 varchar2(25) ) and a table B ( id int PRIMARY KEY, b1 varchar2(25) ). REGISTRATION(BIN, NAME, NAME_ALIAS, COR_GROUP, AUTHOBY, AUTHODATE, CG_NAME, ADD1, ADD2, ADD3, TEL1, FAX1, ADD5, ADD6, ADD7, TEL2, FAX2, ADD9, ADD10, ADD11, TEL3, FAX3, TP_TYPE, TRD_LINC, TRD_FY, TRD_AUTH, IMP_REG, EXP_REG, REG_TYPE, TIN, STATUS, PRE_BIN, DATREG, STAT_CHNG, ACT_CODE, ACT_MULT, ITEM_TYPE, OLD_ACT, APP_CAT, LCODE, ISSUE_DATE, VREG, M_POSI, MFUNC, SFUNC, LAST_USER, LAST_ACCS, TREG, PAY_FREQ, CREG, EREG, OREG, OP_BAL, OP_BAL_DT) select BIN, NAME---- from VIS. Thank u very much for ur kind & very helpful reply. Here the source tables have data with leading spaces and the target data should be without spaces.UPDATE table_a SET column_a_1 = (SELECT table_b.column_b_1 FROM table_b WHERE table_b.user_name = table_a.user_name ) , column_a_2 = (SELECT table_b.column_b_2 FROM table_b WHERE table_b.user_name = table_a.user_name ) WHERE EXISTS ( SELECT * FROM table_b WHERE table_b.user_name = table_a.user_name ) UPDATE in sqlite3 does not support a FROM clause, which makes this a little more work than in other RDBMS.