I need help with copying a row from the same table and editing certain columns to create a new row.
Example Table (yes I know there is not a primary key):
CREATE TABLE myTable (
columnToNotChange JSON, -- this column does not change
columnToNotChangeTwo VARCHAR(5), -- this column does not change either
columnToChange BOOLEAN -- this column I want to change
);
Say I have a row:
columnToNotChange = '{json_object: []}'
columnToNotChangeTwo = "const"
columnToChange = true
What I want to know is how do you copy the data from the columnToNotChange and ColumnToNotChangeTwo but alter the columnToChange to create a new row in the table, myTable.
I've heard of UPDATE FROM (SELECT) statements but haven't found any good documentation for MySQL on UPDATE FROM (SELECT) statements.
I have looked Generic Stackoverflow Question, MySQL Documentation on The UPDATE statement, and W3Schools SQL UPDATE Statement
I appreciate any help.