I have found a lot of answers into how to duplicate a row. It is easy enough, however I haven't seem to have found any examples like what I am looking for. I need to duplicate parts of a row, and add some new data as well.
So duplicating a row:
Insert Into TableName (user, course,title)
Select user, 11 From TableName Where course=6;
How would I duplicate the row, and add my own information to title? Would I put a comma after the select statement?
You can do it the same way you are modifying information for the course - just provide a hard-coded value:
Insert Into TableName (user, course, title)
Select user, 11, 'My New Title' From TableName Where course=6;
^^^^^^^^^^^^^^
It doesn't matter that the data doesn't come from TableName, so long as a value is provided for the field title that you're inserting into.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With