Updating a table from another table
Yes, this is a data warehousing query and I'm doing it in MS Access.
So basically I want some query like this: CREATE TABLE Table1 ( id int identity(1, 1) not null, Long Int Column1 int, Currency Column money ) CREATE TABLE Table2 ( id int identity(1, 1) not null, Long Int Column2 int, Currency Column2 money ) INSERT INTO Table1 VALUES(12, 12.00) INSERT INTO Table1 VALUES(11, 13.00) INSERT INTO Table2 SELECT Long Int Column1, Avg(Currency Column) as Currency Column1 FROM Table1 GROUP BY Long Int Column1 CREATE TABLE Table1 ( id int identity(1, 1) not null, Long Int Column1 int, Currency Column money ) INSERT INTO Table1 VALUES(12, 12.00) INSERT INTO Table1 VALUES(11, 13.00) SELECT Long Int Column1, Avg(Currency Column) as Currency Column1 INTO Table2 FROM Table1 GROUP BY Long Int Column1 I believe your problem in this instance is the "values" keyword.
You can avoid the circular reference by using an alias for avg(Currency Column) (as you did in your example) or by not using an alias at all.
If the column names are the same in both tables, your query would be like this: insert into Doc Type Group Select Doc Grp_Id, Doc Grp_Sub Id, Doc Grp_Group Name, Doc Grp_PM, Doc Grp_Doc Type from Opendatasource( 'SQLOLEDB','Data Source=10.1; User ID=sa; Password=gchaturthi')
Doc Type Group Thank you for your interest in this question.
I have one table A has column (id, field_1,field_2), and another table B has column (id,field_2) Now I want to merge table B to A, that means i want to update field_2 in table A to value of table B. BTW I am using oracle Thanks Now, each time the above is executed, it will do it across all rows in the table.
I know that doesn’t solve the problem, but it is a heck of a lot less noticeable now, since I can put the bad spot against a wall. Chippy you can read about me rescuing my mother’s vintage enamel topped table.He wasn’t being held hostage or anything, he had just been a little mistreated and neglected. This is what he started as and what he looks like now.In Step 1 of the Excel 2003 Wizard, you can select the first option, to create an independent pivot table.Or, select the fourth option, for pivot tables that share the same pivot cache.
Search for updating a table from another table:
You will use the WHERE clause of the UPDATE statement to restrict the update to a single row. The basic syntax is: INSERT, table name, column list, VALUES, and then a list of the values to be inserted.