update from another table
update from another table
От:
"ivan" <IVANCCC@terra.es>
Дата:
dear sir, i would like to know how can i update a table with columns from another table and adding a new column with a secuence, i have try update table set column = (select column from table2), ......, set column=secuence.. is it right????? thanks ivan
Re: update from another table
От:
"Josh Berkus" <josh@agliodbs.com>
Дата:
Ivan, > i would like to know how can i update a table with columns from > another > table and adding a new column with a secuence, You cannot update a table and add a new column at with one statement. Updating a table is Data Manipulation Language (DML) and adding a column is Data Definition Language (DDL) and the two may not be combined. For the update statement: > update table > set column = (select column from table2), ......, set > column=secuence.. > > is it right????? Nope. Try UPDATE table1 SET columnC = table2.columnB FROM table2 WHERE table2.columnA = table1.columnA -Josh Berkus ______AGLIO DATABASE SOLUTIONS___________________________ Josh Berkus Complete information technology josh@agliodbs.com and data management solutions (415) 565-7293 for law firms, small businesses fax 621-2533 and non-profit organizations. San Francisco