Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Insert table values from another table

Status
Not open for further replies.

ToeKnee2

Programmer
Joined
Jun 8, 2006
Messages
21
Location
GB
Hi,

I have two tables: Users and metadata

Users:
id
userid
username


Metadata:
id
userid
value

I would like to extract a list of the userid's from the users table and enter them into the metadata table, with an additional value.

Example:
I want to take all of the userid's from the User table and insert them into the Metadata table, and make the value="one" for each entry into the Metadata table.

Could someone point me in the right direction please?

Thanks,

Tony



 
Code:
INSERT 
  INTO Metadata
     ( userid
     , value )
SELECT userid
     , 'one'
  FROM Users

r937.com | rudy.ca
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top