Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
A confusing SQL statement
I have a table for posts that contains column for user_id for the user that created the post. Its is a Foreign Key linking to my user table. That user is no longer with us I am have to remove him, but currently doing do will remove all of his post. I need to 'transfer' ownership. I can't seem to think out this SQL statement.
Thus far I have. UPDATE TABLE post.user_id WHERE user_id = X SET user_id = Y
If i have understood you correctly you want to change the ID of the post that this user has posted that is no longer with you ?? at the same time you want to keep his posts. What i don't get is why do you need to change user_id?? that would be unique and would not effect your application in anyway?? apologies If i have miss understood you.