![]() |
INSERT Rows where userid=(SELECT id FROM userinfo)
Hello I'm trying to do something like this
Code:
INSERT INTO VotingSite (VotingSiteType, active) VALUES ('10', 0) WHERE userid=(SELECT ID FROM userinfo)It's suppose to add a row with the userid |
You can't use WHERE in INSERT.
Period. Show us what fields you have in the VotingSite table. |
http://gyazo.com/9422820f30a3f8c7c6f03d04c1e92f26
Each user has 11 rows to themselves which is are sites. But when we add a new site into the program we need to add a new row for every user ID USERID VOTINGSITETYPE ACTIVE How can I dynamically add a new row for every user in Users table |
Ahhh...got it.
Code:
INSERT INTO VotingSite (userid, VotingSiteType, active) NOTE: Don't put apostrophes around numeric values ('10' in your example) unless the data type in question really is a string type. |
Thanks, looked like it worked!
|
Insert Rows where userid=(select id from userinfo)
Hi ! INSERT INTO VotingSite (userid, VotingSiteType, active)
SELECT UID, 30, 1 FROM userinfo I think this will work.:) |
Quote:
|
Quote:
No idea where you came up with UID but it's plain flat wrong. |
| All times are GMT +1. The time now is 12:50 PM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.