JJM50 Posted October 7, 2021 Share Posted October 7, 2021 Currently I have a database with the following parameters and entry: https://www.sqlservercentral.com/wp-content/uploads/hm_bbpui/3938402/wimjr5jobcrtsgm158e69cru722hkx4o.png Now I want to fill the column status_from in this particular entry with the id 1 with a substring of the action column. Which is basically I want to fill my status_from column with a word that comes after from and before to of the action column. To achieve this I've tried using the following statement: INSERT INTO crm_logs2(status_from) SELECT status_from WHERE id='1' VALUES (substring_index(substring_index(action, 'from', -1),'to', 1)) But doing this gave me the following error: #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'VALUES (substring_index(substring_index(action, 'from', -1), ...' at line 1 Quote Link to comment Share on other sites More sharing options...
Barand Posted October 7, 2021 Share Posted October 7, 2021 Firstly, I doubt anyone is clicking a link from a first-time poster. Second, what you are doing, updating with parts of a column, is indicative of problems in the database design. What is the structure of those two tables and what does the data look like in the relevant columns? 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.