【问题标题】:Is it possible to select a Paragraph in the Table Row data using MYSQL?是否可以使用 MYSQL 在表格行数据中选择一个段落?
【发布时间】:2013-09-09 00:04:18
【问题描述】:

我的表格行中有一个由段落“分隔”的数据。我需要分别选择并显示每个段落中的数据。

<p>1 The Turtle is slow. </p>
<p>2 The Rabbit is fast. </p>
<p>3 The Horse eats hay. </p>

甚至有可能做到这一点吗?如果没有,有没有其他可能的方法可以让它工作?

【问题讨论】:

    标签: mysql select paragraph


    【解决方案1】:

    您可以使用substring_index() 基本上做到这一点。

    如果你想要第一段:

    select replace(substring_index(col, '</p>', 1), '<p>', '')
    

    第二个:

    select replace(substring_index(substring_index(col, '</p>', 2), '</p>', -1), '<p>', '')
    

    【讨论】:

      猜你喜欢
      • 2013-12-08
      • 1970-01-01
      • 2021-02-07
      • 2011-01-14
      • 2016-11-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多