Will using variables be an option for you?
SET @path = (SELECT path_enumeration FROM COC_FIELD WHERE field_id = 'field_2');
INSERT INTO COC_FIELD(field_id, name, path_enumeration)
VALUES ('field_2', 'Month', CONCAT(IFNULL(@path, ''), '/', 'field_3'));
First statement sets a variable named path
which will then be used in the insert statement. I used an additional IFNULL
check to prevent getting null
values if @path
is null.
Please note that I had to remove report_query_id
field for my tests.