Search code examples
mysqlsqlnsregularexpression

Filter specific records from mysql text query


I have a very long text file which contains mysql data (insert commands with data). I want to extract specific data based on id (specific insert string). here is the example of my data.

INSERT INTO tbl_emp_leave_details VALUES (1405,0,'2020-09-01','2020-09-01',0.5,2,'00:00:00','.5',2,'Some Personal work','2020-01-09 11:25:26',18,0,0,NULL,NULL,0,0,NULL,''),(4612,1,'2021-05-01','2021-05-01',1,5,'00:00:00','1',-1,'1st may was holiday this why this is ignored','2021-07-06 10:45:55',1,1,81,'2021-08-01 18:04:59','Approved (Auto Query)',1,81,'2021-08-02 18:04:59','Approved (Auto Query)'), and so on

I want to filter based on the second column value. if the second column value is 81.


Solution

  • Thanks to @Akina comment i have resolved it.

    1. Created temp table with mysql file

    2. and form temp table I updated my original table