lin5245879
lin5245879
采纳率0%
2019-03-28 20:10 浏览 462

如何提取 mysql 列里的字符串

10

mysql里面,我想提取字符串每一个包含
name="XXXXXXX" display="XXXXX"
的字符串

我该怎么办?

SELECT
a.FIELD_INFO
form_definition AS a

TableList












      <Field id="-2282990529878996205" name="field0001" display="日期" fieldtype="TIMESTAMP" fieldlength="255,0" is_null="false" is_primary="false" classname="" barcode=""/>
      <Field id="1311132989919284655" name="field0002" display="填表人" fieldtype="VARCHAR" fieldlength="255,0" is_null="false" is_primary="false" classname="" barcode=""/>
      <Field id="852302268771746414" name="field0003" display="单据编号" fieldtype="VARCHAR" fieldlength="255,0" is_null="false" is_primary="false" classname="" barcode=""/>
      <Field id="-7027604062977111670" name="field0004" display="使用单位" fieldtype="VARCHAR" fieldlength="255,0" is_null="false" is_primary="false" classname="" barcode=""/>
      <Field id="-727613705713006098" name="field0005" display="联系人" fieldtype="VARCHAR" fieldlength="255,0" is_null="false" is_primary="false" classname="" barcode=""/>
      <Field id="2045478367826758515" name="field0006" display="联系电话" fieldtype="VARCHAR" fieldlength="255,0" is_null="false" is_primary="false" classname="" barcode=""/>
      <Field id="1703097503935712726" name="field0007" display="使用地址" fieldtype="VARCHAR" fieldlength="255,0" is_null="false" is_primary="false" classname="" barcode=""/>
      <Field id="-2958909336678481373" name="field0016" display="状态-已转销售" fieldtype="VARCHAR" fieldlength="255,0" is_null="false" is_primary="false" classname="" barcode=""/>
      <Field id="6814340795750172179" name="field0017" display="设备状态-自有" fieldtype="VARCHAR" fieldlength="255,0" is_null="false" is_primary="false" classname="" barcode=""/>









  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

4条回答 默认 最新

  • haozi_e 红橡树 2019-03-28 20:51

    一般不再mysql里做这种操作,你可以在应用层通过正则表达式去匹配,比如在java里去处理

    点赞 评论 复制链接分享
  • weixin_42080504 have_power 2019-03-29 10:04

    It's so easy!

    SELECT
        substr(
            a.FIELD_INFO,
            instr(a.FIELD_INFO, 'name'),
            instr(a.FIELD_INFO, 'fieldtype') - instr(a.FIELD_INFO, 'name')
        ) need,
        instr(a.FIELD_INFO, 'name'),
        instr(a.FIELD_INFO, 'fieldtype')
    FROM
        table_name a
    
    点赞 评论 复制链接分享
  • m0_37687832 qq570398110 2019-03-31 15:51

    SELECT
    a.FIELD_INFO
    form_definition AS a where name like %xxxx% or display like %xxxx%;

    点赞 评论 复制链接分享
  • hu_wen_wei wayne.hu 2019-04-18 13:36

    full-text index

    点赞 评论 复制链接分享

相关推荐