1. <tfoot id='cBNry'></tfoot>

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

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

      3. mysql |来自空列和 FIND_IN_SET 的请求

        时间:2023-10-12
          <bdo id='le79l'></bdo><ul id='le79l'></ul>

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

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

                  <tbody id='le79l'></tbody>
                  <tfoot id='le79l'></tfoot>
                  <i id='le79l'><tr id='le79l'><dt id='le79l'><q id='le79l'><span id='le79l'><b id='le79l'><form id='le79l'><ins id='le79l'></ins><ul id='le79l'></ul><sub id='le79l'></sub></form><legend id='le79l'></legend><bdo id='le79l'><pre id='le79l'><center id='le79l'></center></pre></bdo></b><th id='le79l'></th></span></q></dt></tr></i><div id='le79l'><tfoot id='le79l'></tfoot><dl id='le79l'><fieldset id='le79l'></fieldset></dl></div>
                  本文介绍了mysql |来自空列和 FIND_IN_SET 的请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有一张桌子:

                  id  name   position   status
                  1   A      1,2        1
                  2   B      1          1
                  3   C                 1
                  4   D      2          1
                  

                  其中:position 列是一个文本字段;我的请求在这里:

                  Where: position column is a text field; My request is here:

                  SELECT `id` 
                  FROM  `table` 
                  WHERE `status`=1
                  AND `position` >  ''
                  AND `position` = FIND_IN_SET( 1,  `position` ) 
                  OR  `position` = FIND_IN_SET( 2,  `position` ) 
                  

                  此请求将返回:1,2,3,4.这是我需要的错误:1,2,4 ->条件:(position > '').哪里有问题以及如何更改我的请求?谢谢.

                  This request will return: 1,2,3,4. This is a wrong as I need: 1,2,4 -> Condition: (position > ''). Where is a problem and how to change my request? Thanks.

                  推荐答案

                  您在检查字段列表中的数字时无需检查位置是否为空.

                  you dont need to check if position is empty while you checking numbers in field list .

                  你不需要检查 position = FIND_IN_SET.... .它将返回 1 所在位置的值.

                  you dont need to check position = FIND_IN_SET.... . it will return the value where 1 is in position.

                  你需要这样做:

                   SELECT `id` 
                   FROM  `table` 
                   WHERE `status`=1
                   AND  FIND_IN_SET( 1,  `position` ) 
                   OR   FIND_IN_SET( 2,  `position` ) 
                  

                  此处演示

                  这篇关于mysql |来自空列和 FIND_IN_SET 的请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:Symfony 2 - 在服务内处理内核请求(来自另一个应用程序) 下一篇:PHP GuzzleHttp.如何使用参数进行发布请求?

                  相关文章

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

                    • <bdo id='8s2op'></bdo><ul id='8s2op'></ul>

                    <small id='8s2op'></small><noframes id='8s2op'>

                    <tfoot id='8s2op'></tfoot>
                    <legend id='8s2op'><style id='8s2op'><dir id='8s2op'><q id='8s2op'></q></dir></style></legend>