View Single Post
Old 09-24-2012, 11:44 PM   PM User | #4
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,244
Thanks: 59
Thanked 3,998 Times in 3,967 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
Ahhh...got it.

Code:
INSERT INTO VotingSite (userid, VotingSiteType, active) 
SELECT ID, 10, 0 FROM userinfo
See that? You can SELECT both fields *AND CONSTANT VALUES* from a table, so combine that with INSERT INTO and you are done.

NOTE: Don't put apostrophes around numeric values ('10' in your example) unless the data type in question really is a string type.
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
Old Pedant is online now   Reply With Quote