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

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

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

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

        MySQL IN 和 LIKE

        MySQL IN with LIKE(MySQL IN 和 LIKE)
        <i id='QaR86'><tr id='QaR86'><dt id='QaR86'><q id='QaR86'><span id='QaR86'><b id='QaR86'><form id='QaR86'><ins id='QaR86'></ins><ul id='QaR86'></ul><sub id='QaR86'></sub></form><legend id='QaR86'></legend><bdo id='QaR86'><pre id='QaR86'><center id='QaR86'></center></pre></bdo></b><th id='QaR86'></th></span></q></dt></tr></i><div id='QaR86'><tfoot id='QaR86'></tfoot><dl id='QaR86'><fieldset id='QaR86'></fieldset></dl></div>
        <legend id='QaR86'><style id='QaR86'><dir id='QaR86'><q id='QaR86'></q></dir></style></legend>

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

              <bdo id='QaR86'></bdo><ul id='QaR86'></ul>
                  <tfoot id='QaR86'></tfoot>
                    <tbody id='QaR86'></tbody>
                1. 本文介绍了MySQL IN 和 LIKE的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我将如何使用带有 like 的 IN 表?这样我就可以在其中使用 % 了吗?我的意思是:

                  How would I use a IN table with like? So that I could use % in them? By in I mean:

                  SELECT fields 
                    FROM table 
                   WHERE age = "50" 
                     AND name IN ("tim", "bob", "nancy", "john");
                  

                  我已经试过了:

                  SELECT fields 
                    FROM table 
                   WHERE age = "50" 
                     AND name LIKE ("2010-09-17%", "2010-09-16%")
                  

                  但它给出了错误操作数应该包含 1 列"

                  But it gave the error "Operand should contain 1 column(s)"

                  推荐答案

                  您可以使用多个 LIKE 表达式:

                  You can use a number of LIKE expressions:

                  SELECT fields 
                    FROM table 
                    WHERE age = "50" 
                          AND (
                               name LIKE "2010-09-17%" 
                               OR name LIKE "2010-09-16%"
                              );
                  

                  或者你可以使用正则表达式:

                  or you can use a regex:

                  SELECT fields 
                    FROM table 
                   WHERE age = "50" 
                         AND name REGEXP "2010-09-17.*|2010-09-16.*";
                  

                  或者,巧妙地

                  SELECT fields 
                    FROM table 
                   WHERE age = "50" 
                         AND name REGEXP "2010-09-1(6|7).*";
                  

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

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

                  相关文档推荐

                  Building a comma separated list?(建立一个逗号分隔的列表?)
                  Errors in SQL Server while importing CSV file despite varchar(MAX) being used for each column(尽管每列都使用了 varchar(MAX),但在导入 CSV 文件时 SQL Server 中出现错误)
                  How can I import an Excel file into SQL Server?(如何将 Excel 文件导入 SQL Server?)
                  Export table to file with column headers (column names) using the bcp utility and SQL Server 2008(使用 bcp 实用程序和 SQL Server 2008 将表导出到带有列标题(列名称)的文件)
                  Concat field value to string in SQL Server(将字段值连接到 SQL Server 中的字符串)
                  SQL Server Bulk insert of CSV file with inconsistent quotes(SQL Server 批量插入带有不一致引号的 CSV 文件)

                  • <legend id='Ip3nT'><style id='Ip3nT'><dir id='Ip3nT'><q id='Ip3nT'></q></dir></style></legend>

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

                          <tfoot id='Ip3nT'></tfoot>
                          1. <small id='Ip3nT'></small><noframes id='Ip3nT'>