如何从MySQL文本字段中选择一行

时间:2016-11-15 09:56:33

标签: mysql preg-match

假设我有一个mysql表,其中包含两列,一列是作业号,另一列是相应作业的stderr:

+----------+---------+------+-----+---------+-------+
| Field    | Type    | Null | Key | Default | Extra |
+----------+---------+------+-----+---------+-------+
| job      | int(11) | YES  | UNI | NULL    |       |
| jerrors  | text    | YES  |     | NULL    |       |
+----------+---------+------+-----+---------+-------+

该文字包含换行符。 我想从jerrors中只选择包含给定单词的行,例如

(\n.*word*.*\n)

我如何构建此类查询?如果我做

SELECT job, jerrors FROM mytable WHERE jerrors LIKE "%No such file%";

然后我在专栏中得到全文。

这是一个示例文本

Error in <TCling::RegisterModule>: cannot find dictionary module A2Dict_rdict.pcm
Error in <TCling::RegisterModule>: cannot find dictionary module A1Dict_rdict.pcm
Error in <TCling::RegisterModule>: cannot find dictionary module SpectraDict_rdict.pcm
PedestalT0 File : conf/A2-roT0.job1685_0-run1685_2.dat: No such file or directory
[A1DataDecoder] WARNING: 12 Slots for 20 pedestals! Using '16' for last 19 pedestals ...
Error in <TInterpreter::TCling::AutoLoad>: failure loading library libMathMore.so for ROOT::Math::GSMIntegrator

0 个答案:

没有答案