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 MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Inserting a fixed value and also selected values into table

Status
Not open for further replies.

emozley

Technical User
Jan 14, 2003
769
GB
Hi,

I have a table called Users which has a column UserID and Department. I want to add every UserID that has a department value of 3 to a table called Attendees:

INSERT INTO Attendees
SELECT UserID AS UserID
FROM Users
WHERE Department=3;

This works fine but the Attendees table also has a column called MeetingID. If I wanted to make add the value 100 to this column for all records inserted is this possible?

cheers

Ed
 
INSERT
INTO Attendees
( UserID
, MeetingID )
SELECT UserID
, 100
FROM Users
WHERE Department=3


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

Part and Inventory Search

Sponsor

Back
Top