472,139 Members | 1,680 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,139 software developers and data experts.

copying columns???????

is it possible to copy one coumn from within a database table to another table with in the same database, i am using sql 4.1
Aug 7 '06 #1
3 1546
ronverdonk
4,258 Expert 4TB
Something like
Expand|Select|Wrap|Line Numbers
  1. UPDATE table_xx, table_yy 
  2. SET table_xx.count=table_yy.number 
  3. WHERE table_xx.id=table_yy.id;
where you update the column `count` in `table_xx` with the values from column `number` in table `table_yy` as long as columns `id` in both tables match?

Ronald :cool:
Aug 9 '06 #2
is there anyway to do with without the WHEREE claus as its a new table i am copying into and have nothing to reference it against
Aug 11 '06 #3
ronverdonk
4,258 Expert 4TB
Assuming that you have created a table_y with an auto-increment key:
Expand|Select|Wrap|Line Numbers
  1. insert table_y (name) select name from table_x;
Ronald :cool:
Aug 11 '06 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by Rebecca Lovelace | last post: by
4 posts views Thread by Gordon Burditt | last post: by
2 posts views Thread by Stefan Schneider | last post: by
1 post views Thread by Mark Smith | last post: by
5 posts views Thread by Nathan Sokalski | last post: by
2 posts views Thread by Rick Palmer | last post: by
1 post views Thread by byrd48 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.