join for insert statement mysql syntax
hey I have two tables and Im looking to make a mysql sytax statement for insert:
Table structure:
Im trying to insert userid and picturepath (which i can do) but how would I insert into flag in the user table aswell in the same insert syntax:
("INSERT INTO Pictures (UserID, picturepath) VALUES (" + theUserId + ", '" + fileuploadpaths + "')", cn);
theuserid is set by a session so I can reuse the开发者_JAVA技巧 string for that to know which coloum to insert into the user.
gonna have to do an update statment after the insert statement
("INSERT INTO Pictures (UserID, picturepath) VALUES (" + theUserId + ", '" + fileuploadpaths + "') "+
"GO UPDATE user SET flag = 1 WHERE UserID = "+theUserId+" GO", cn);
might work
try to execute this command in sql management if you have it with test data to make sure it allows this to work like this
精彩评论