Combining tables

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
Shendemiar
Forum Contributor
Posts: 404
Joined: Thu Jan 08, 2004 8:28 am

Combining tables

Post by Shendemiar »

I have two tables:

A: 'x','y','attr'

and

B: 'x','y','ter','attr'

Both having same the same x and y's

I'm trying to insert the 'attr' from A to B

Something like

insert into B ('attr')
select 'attr' from A

But i cant make it work. It gets executed, but all 'attr' valueas in B are still 0
User avatar
tim
DevNet Resident
Posts: 1165
Joined: Thu Feb 12, 2004 7:19 pm
Location: ohio

Post by tim »

V
Forum Newbie
Posts: 3
Joined: Tue Mar 16, 2004 1:15 pm
Location: Keller, Tx.
Contact:

Post by V »

It should probably also be noted that you'll wanna drop the quotes from the column name you're selecting from, else you'll be inserting the column name and not the data from the column.
Shendemiar
Forum Contributor
Posts: 404
Joined: Thu Jan 08, 2004 8:28 am

Post by Shendemiar »

I perhaps should be looking update instead of insert...

I want no new lines, just a column added to another table.
Post Reply