<legend id='5jXNN'><style id='5jXNN'><dir id='5jXNN'><q id='5jXNN'></q></dir></style></legend>
  • <small id='5jXNN'></small><noframes id='5jXNN'>

  • <tfoot id='5jXNN'></tfoot>

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

      1. 如何在 MySQL 中实现关键字搜索?

        How to implement a Keyword Search in MySQL?(如何在 MySQL 中实现关键字搜索?)
          <bdo id='WuL4D'></bdo><ul id='WuL4D'></ul>

        • <small id='WuL4D'></small><noframes id='WuL4D'>

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

                    <tbody id='WuL4D'></tbody>
                  本文介绍了如何在 MySQL 中实现关键字搜索?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我是 SQL 编程的新手.

                  I am new to SQL programming.

                  我有一个表格作业,其中的字段是 idpositioncategorylocation薪资范围, description, refno.

                  I have a table job where the fields are id, position, category, location, salary range, description, refno.

                  我想从前端实现关键字搜索.关键字可以位于上表的任何字段中.

                  I want to implement a keyword search from the front end. The keyword can reside in any of the fields of the above table.

                  这是我尝试过的查询,但它包含如此多的重复行:

                  This is the query I have tried but it consist of so many duplicate rows:

                  SELECT
                      a.*,
                      b.catname
                  FROM
                      job a,
                      category b
                  WHERE
                      a.catid = b.catid AND
                      a.jobsalrange = '15001-20000' AND
                      a.jobloc = 'Berkshire' AND
                      a.jobpos LIKE '%sales%' OR
                      a.jobloc LIKE '%sales%' OR
                      a.jobsal LIKE '%sales%' OR
                      a.jobref LIKE '%sales%' OR
                      a.jobemail LIKE '%sales%' OR
                      a.jobsalrange LIKE '%sales%' OR
                      b.catname LIKE '%sales%'
                  

                  推荐答案

                  对于 VARCHAR 字段上的单个关键字,您可以使用 LIKE:

                  For a single keyword on VARCHAR fields you can use LIKE:

                  SELECT id, category, location
                  FROM table
                  WHERE
                  (
                      category LIKE '%keyword%'
                      OR location LIKE '%keyword%'
                  )
                  

                  对于描述,您通常最好添加全文索引并执行 全文搜索(仅限 MyISAM):

                  For a description you're usually better adding a full text index and doing a Full-Text Search (MyISAM only):

                  SELECT id, description
                  FROM table
                  WHERE MATCH (description) AGAINST('keyword1 keyword2')
                  

                  这篇关于如何在 MySQL 中实现关键字搜索?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  ibtmp1是非压缩的innodb临时表的独立表空间,通过innodb_temp_data_file_path参数指定文件的路径,文件名和大小,默认配置为ibtmp1:12M:autoextend,也就是说在文件系统磁盘足够的情况下,这个文件大小是可以无限增长的。 为了避免ibtmp1文件无止境的暴涨导致
                  SQL query to group by day(按天分组的 SQL 查询)
                  What does SQL clause quot;GROUP BY 1quot; mean?(SQL 子句“GROUP BY 1是什么意思?意思是?)
                  MySQL groupwise MAX() returns unexpected results(MySQL groupwise MAX() 返回意外结果)
                  MySQL SELECT most frequent by group(MySQL SELECT 按组最频繁)
                  Include missing months in Group By query(在 Group By 查询中包含缺失的月份)
                • <i id='ygnwI'><tr id='ygnwI'><dt id='ygnwI'><q id='ygnwI'><span id='ygnwI'><b id='ygnwI'><form id='ygnwI'><ins id='ygnwI'></ins><ul id='ygnwI'></ul><sub id='ygnwI'></sub></form><legend id='ygnwI'></legend><bdo id='ygnwI'><pre id='ygnwI'><center id='ygnwI'></center></pre></bdo></b><th id='ygnwI'></th></span></q></dt></tr></i><div id='ygnwI'><tfoot id='ygnwI'></tfoot><dl id='ygnwI'><fieldset id='ygnwI'></fieldset></dl></div>
                    <tbody id='ygnwI'></tbody>

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

                      <bdo id='ygnwI'></bdo><ul id='ygnwI'></ul>
                        • <tfoot id='ygnwI'></tfoot>

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