• <tfoot id='J44dO'></tfoot>
      <bdo id='J44dO'></bdo><ul id='J44dO'></ul>
    1. <legend id='J44dO'><style id='J44dO'><dir id='J44dO'><q id='J44dO'></q></dir></style></legend>

      <small id='J44dO'></small><noframes id='J44dO'>

        <i id='J44dO'><tr id='J44dO'><dt id='J44dO'><q id='J44dO'><span id='J44dO'><b id='J44dO'><form id='J44dO'><ins id='J44dO'></ins><ul id='J44dO'></ul><sub id='J44dO'></sub></form><legend id='J44dO'></legend><bdo id='J44dO'><pre id='J44dO'><center id='J44dO'></center></pre></bdo></b><th id='J44dO'></th></span></q></dt></tr></i><div id='J44dO'><tfoot id='J44dO'></tfoot><dl id='J44dO'><fieldset id='J44dO'></fieldset></dl></div>

        带下划线的 MySQL LIKE 查询

        MySQL LIKE query with underscore(带下划线的 MySQL LIKE 查询)
        1. <legend id='TWkpg'><style id='TWkpg'><dir id='TWkpg'><q id='TWkpg'></q></dir></style></legend>

                <bdo id='TWkpg'></bdo><ul id='TWkpg'></ul>

                1. <small id='TWkpg'></small><noframes id='TWkpg'>

                  <i id='TWkpg'><tr id='TWkpg'><dt id='TWkpg'><q id='TWkpg'><span id='TWkpg'><b id='TWkpg'><form id='TWkpg'><ins id='TWkpg'></ins><ul id='TWkpg'></ul><sub id='TWkpg'></sub></form><legend id='TWkpg'></legend><bdo id='TWkpg'><pre id='TWkpg'><center id='TWkpg'></center></pre></bdo></b><th id='TWkpg'></th></span></q></dt></tr></i><div id='TWkpg'><tfoot id='TWkpg'></tfoot><dl id='TWkpg'><fieldset id='TWkpg'></fieldset></dl></div>
                2. <tfoot id='TWkpg'></tfoot>

                    <tbody id='TWkpg'></tbody>
                  本文介绍了带下划线的 MySQL LIKE 查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有下表images:

                  +----+--------------+
                  | id |   img_path   |
                  +----+--------------+
                  | 1  | abc_1.jpg    |
                  | 2  | abc_2.jpg    |
                  | 3  | abcde_1.jpg  |
                  | 4  | abcde_2.jpg  |
                  | 5  | abcdef_1.jpg |
                  +----+--------------+
                  

                  我想选择img_pathabc_开头的条目,所以我使用以下查询:

                  I would like to select the entries that img_path starts with abc_, so I use the following query:

                  SELECT id FROM images WHERE img_path LIKE 'abc_%'
                  

                  但它返回所有 5 行.我如何只返回 id = 1 &2(哪个img_pathabc_开头)?

                  But it returns all 5 rows. How do I only returns id = 1 & 2 ( which img_path starts with abc_) ?

                  推荐答案

                  发现 _ 是一个特殊字符.必须使用反斜杠转义.

                  Found out that _ is a special character. Have to escape with backslashes.

                  SELECT id FROM images WHERE img_path LIKE 'abc\_%'
                  

                  按预期返回 2 行

                  这篇关于带下划线的 MySQL LIKE 查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Bogus foreign key constraint fail(虚假外键约束失败)
                  how to get last insert id after insert query in codeigniter active record(如何在codeigniter活动记录中插入查询后获取最后一个插入ID)
                  Force InnoDB to recheck foreign keys on a table/tables?(强制 InnoDB 重新检查表/表上的外键?)
                  How to auto generate migrations with Sequelize CLI from Sequelize models?(如何使用 Sequelize CLI 从 Sequelize 模型自动生成迁移?)
                  Clear MySQL query cache without restarting server(无需重启服务器即可清除 MySQL 查询缓存)
                  ALTER TABLE to add a composite primary key(ALTER TABLE 添加复合主键)

                    <legend id='sxmqY'><style id='sxmqY'><dir id='sxmqY'><q id='sxmqY'></q></dir></style></legend>

                      <small id='sxmqY'></small><noframes id='sxmqY'>

                    1. <i id='sxmqY'><tr id='sxmqY'><dt id='sxmqY'><q id='sxmqY'><span id='sxmqY'><b id='sxmqY'><form id='sxmqY'><ins id='sxmqY'></ins><ul id='sxmqY'></ul><sub id='sxmqY'></sub></form><legend id='sxmqY'></legend><bdo id='sxmqY'><pre id='sxmqY'><center id='sxmqY'></center></pre></bdo></b><th id='sxmqY'></th></span></q></dt></tr></i><div id='sxmqY'><tfoot id='sxmqY'></tfoot><dl id='sxmqY'><fieldset id='sxmqY'></fieldset></dl></div>
                        <tbody id='sxmqY'></tbody>
                      <tfoot id='sxmqY'></tfoot>
                            <bdo id='sxmqY'></bdo><ul id='sxmqY'></ul>