MYSQL:
SELECT *
FROM invoice
WHERE 'ID' IN('58,59,60,61,62,63,64,65,66,67,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,86,87,88,89,90,91,92,93,94,95,96,97,98,99,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155')
所有ID都在表发票中,但它返回0行,任何人都可以帮助我如何解决此问题?
答案 0 :(得分:6)
您应该将数组传递给IN函数,请查看以下链接以获取更多信息:MySQL IN
以下查询应该适合您:
SELECT
*
FROM
invoice
WHERE ID IN(58,59,60,61,62,63,64,65,66,67,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,86,87,88,89,90,91,92,93,94,95,96,97,98,99,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155)
或者,如果您在58和155之间具有给定发票ID的序列,则可以使用
SELECT
*
FROM
invoice
WHERE ID BETWEEN 58 AND 155;
答案 1 :(得分:1)
试试这个。在ID中删除''。
SELECT *
FROM invoice
WHERE
ID IN (58,59,60,61,62,63,64,65,66,67,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,86,87,88,89,90,91,92,93,94,95,96,97,98,99,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,
150,151,152,153,154,155)
答案 2 :(得分:1)
当你通过时:
SyntaxError: Unexpected token % in JSON at position 0 at Object.parse (<anonymous>) at XMLHttpRequest.onLoad (http://localhost:4200/vendor.bundle.js:19297:37) at ZoneDelegate.webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invokeTask (http://localhost:4200/polyfills.bundle.js:2513:31) at Object.onInvokeTask (http://localhost:4200/vendor.bundle.js:51730:33) at ZoneDelegate.webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invokeTask (http://localhost:4200/polyfills.bundle.js:2512:36) at Zone.webpackJsonp.../../../../zone.js/dist/zone.js.Zone.runTask (http://localhost:4200/polyfills.bundle.js:2280:47) at ZoneTask.webpackJsonp.../../../../zone.js/dist/zone.js.ZoneTask.invokeTask [as invoke] (http://localhost:4200/polyfills.bundle.js:2587:34) at invokeTask (http://localhost:4200/polyfills.bundle.js:3628:14) at XMLHttpRequest.globalZoneAwareCallback (http://localhost:4200/polyfills.bundle.js:3654:17)
text
:
"%PDF-1.4↵1 0 obj↵<<↵/Title (��)↵/Creator (��)↵/Producer (��Qt 4.8.4 \(C\) 2011 Nokia Corporation and/or its subsidiary\(-ies\))↵/CreationDate (D:20171105151737+05'45')↵>>↵endobj↵3 0 obj↵<<↵/Type /ExtGState↵/SA true↵/SM 0.02↵/ca 1.0↵/CA 1.0↵/AIS false↵/SMask /None>>↵endobj↵4 0 obj↵[/Pattern /DeviceRGB]↵endobj↵6 0 obj↵<<↵/Type /XObject↵/Subtype /Image↵/Width 636↵/Height 116↵/BitsPerComponent 8↵/ColorSpace /DeviceGray↵/Length 7 0 R↵/Filter /FlateDecode↵>>↵stream↵x������`��@*�6R�R\E�K�↵l�-���&�ZF����x�9�sf���w�����hd��=:aO��n��V�+o9��-�#� ښ� ���G�����?�����:�g��G��=7��:�뭬~�������$ܯ���ȤW�C���鳜u|��)���C�v^-���'F���������FIAy�SU$��tu-'0�R�6��ʳ ��n}qS��г�>]]krqѿ�ꆋ��M�8��e{���]���C��ܬ�Gw���W�-�ͬ��<����n�ZFǛ�Qx�����P�����WC�=��Th*�ڃ↵�A���B{P�=��Th*�ڃ↵�A���B{P�=��Th*�ڃ↵�A���B{P�=��Th*�ڃ↵�A���B{P�=��Th*�ڃ↵�A���B{P�=��Th*�ڃ↵�A���B{P�=��Th*�ڃ↵�A���B{P�=��Th*�ڃ↵�A���B{P�=��T���+�W�G�-�ۛxqV����n�ZFǛ�Qx��F�`����?�S{�l`UnVv�=~60�2��I�=k&Ç�UE.�F{#ۏ�;�_�=���ɭ�� ̙��~�g8����n��E����vz��{��ԇ�T���|q]�u|��͇�T��!^?_���u�ȤL�P�^j"�yqq�g�A�dyt-ϒ8p헫�9}��쀮�m���}N��[m�����7�����=�fO�T��-��endstream↵endobj↵7 0 obj↵760↵endobj↵8 0 obj↵<<↵/Type /XObject↵/Subtype /Image↵/Width 636↵/Height 116↵/BitsPerComponent 8↵/ColorSpace /DeviceRGB↵/SMask 6 0 R↵/Length 9 0 R↵/Filter /FlateDecode↵>>↵stream↵x���
�Om�`�endstream↵endobj↵9 0 obj↵237↵endobj↵10 0 obj↵<<↵/Type /XObject↵/Subtype /Image↵/Width 555↵/Height 100↵/BitsPerComponent 8↵/ColorSpace /DeviceRGB↵/Length 11 0 R↵/Filter /DCTDecode↵>>↵stream↵����JFIFHH��C ↵↵
↵↵
��C��d+"�� ↵���}!1AQa"q2���#B��R��$3br� ↵%&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz��������������������������������������������������������������������������� ↵���w!1AQaq"2�B���� #3R�br�↵$4�%�&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz��������������������������������������������������������������������������?����(�"��?l����u��wha"�N��#�Z����Dv�%�↵���+֮&�ʨ��,p��+�����t��(w�-������_��↵�M'ÖQ��o�9!%2Ȝ�Y���?�)s/���e�>ˁ�RY�b�T��J�����Q����,~m�9���C��P��w��<k��/�t�G��t+�iih�<�.~i�����i]6��x��/�↵��4����,���xi��-jP_�P~�P,6�);q�6��~A\�������ȼke�Ѭ�s�i��ġUKs�3l����ɫ�o�7��hI��KG�կa($Q,p�9ڊ�HʡݸU',x���o�4�RY�}6���o��]�s{�v����wc��o�↵���K�hBԝ��T� �(�S[T���U�2��P�,S:��?�j���/���a-�n�塳�l"v�唌�6w`:�l.I���'M����E������U�,��bAs9uh���o?yNc���/�f��ߴ�.����IԼY��9�P��&��H�����iX#`c��w5�~�� �7���▛�+E�5=X"���R enʩ��P�'TM�)�P`��O����]Tc����e�m�>m��zk��
n/�Z�?�O5��7��s��I^ܜ�����l|U�~��|@��N����3ƶ6�̖wh���`�[i�↵�/M���I��j���4��� ���P��ݩw�h. A�X�4J[��T�����k���k�{�Y,o���VZ�o�^ Ta���<+k�?�[�T��c n�D�h�,���!�J_���q����x�����,�^�uq�ݺ��ݕ��^�z?�<)�C����Y�Jtj��VQ��O�TMr�nMZ�>G�$Ӻ����?���?�ĚLgI�� ���;f�E��=F�%2��{��_�ߴ���
���������!:�����&��ky���(Y�����W��x�F����+�;�R{y�m�4n+�� ��_�`q~��IGG�?F��:�p��,lcM�Q����-����+�讹ekI|����<E�� ��+)���?�H]�䦼� ��A���D�-߂m5�2_\C
ݮ�qL�*�I#�(v0��k����?�o���N�kBӥۮ|J���H��d���G��B���W�?���[?�%o���>�����_|gcr�\,��b(���H�E&��m:�TQ[u��~M�ͪR�!F6�j�}ӛj?����[6)�_�_���#��������~�|qa��N�6���-~[�%�W�VS�6%�1�\��q��'���Bx��G�a�/��)��X�?�ˉ����c����&�?�s v��\�7��qO�ǚ�:%�RU}�,�w�Y�����[��_�c�5��/�!�U�776>�n5;���4��m#*@,B��r?���Y�~�_�މ���~��i:�L��j�,WQ�R�Gr� d�#��W��'�A~���W�ѫ�v�'ĝ&?���o�������㠃f}������ssK���|b���^|���?>:x����Z�ݔ�b�x���A�%.Y�$T�Bz����Z�`��J�T�Z�n�����↵P��_~����g�ڻ����"����X�^��ȭ���C�����#�+�a�F`��������� ��Ix�ľ-�S�_����t;�eo�H,�H�D@���~`s�5��[5��;c���5!(����ܪﭝ�X������<+�x[������sR��^��j�dQ����Ͻ����]���Mx+@��|2���Eg6�i�Ǘ�[D��i�V�`��g� �m_��*��?�����|o����mg�5��C&r�\"����ª��[_�|m����çxk�n�����DmOI���H���o��B�3���O͜�N���Go���Uwh�N�^�M����@4����������?�߶��_�?x�]W��u�����Z��c�.T�d@��i˖<W�_��_���!��/�w�:�o�>��z~���j�mm�٩�D#�ۉ_����xn�m_��e��PS��o����$ϧ�@�ڿ4~k��/�?d�|Qx;_�� �zu߃�[�m�-�3����i#D. ����s����[��~3����|<�I�������@�T�F�
�؎FXđ��3�R~PqG�Z]=Iy���$�k7n�˭��N�O�f���¿��ߊ_4=3]���_%��5�Q��óȠ�U�#1���`��C��>��mh����]^?�Omh�D���*�n��8�3_3����������sT���(�o�?�Z��+x��9�ӵL��S�[����S3�fK�ԚZi����z_��� ���~,i~�?�'X�f[}=�C`�Z��� �����$���_uo�ɯ�/�8�ெ�o�'~��Ѥ�[x�����֗�C�qn^e��8�!���U=Ey����������%�s����
?Ş,���7��`���C��@S�Upn3�m�Ƴj�J���jmr���_��k7k�ot�~�npEǨ�ȟ�C>?x��?��|k�G��/�ϳ[ꖾ.�m��m�M� �v�h��;�A…D�������c�z�'l���u���3锗*���G����:?��↵��J?K�M�����͊�y���A!�6H�r����ݕܐ?x�����������p}ᩓ/��3,����j����c��������է�9v�V�8~3���rBYaeY(6j;�d
w�������֧w:W�M�&1���ɷ��XG����~������Ć�eZH���aZ����yB�>薃�o'賗Ao���^[1�B;�gN[[*�A�Ja�,��9��Ε����E(*����ܶ���㋗�=���<|�>\X��J5�m�
¹Y�����(���a0��m�T����h}qI^>w�������<z�ϟ��ii�XU�6>�~��)#3�c�>��:�v5������b��b�x�H%�)$j�K�W7X�?x�豣�����[H���}}t��$�1�u~�;�8�m�3���X����wu��+�z`{Oݲ���t�4�֫��k��r��YG�qA{���Bʬ[��z/HZOZ3��z�U1\�um���7��LO9ڭ��{��L�s[}}����X5��#�^�ǃ��;|����3���������gV���-W�iip�ڪt����U��7�>���c�f�K��m���{|�)��+=��,���Q����[>}h}�o�f��o��^Xw)�e�0��$�KKǀ#j�ܿ"�<��\�A�t�2�t�I\9<5x�~.ݰ��}8~�O�{��O~+�.z�^�_pM\�{��'��YR��Ed↵�kӒ[����,}79ob↵��41G�h��-d#���'��q[I)���m@�G����kI�1�:�ȼ��HMIH�<��K�����o[�~�
��!�E��x���2Z�0%���M̑"j5�����&�I1���Jj�)ۀ������B.>3�5/p���C\��)Q�E�C\�v�!�@\��t�2����!.G9�D\����ۑ�.�
��@\�|,9�x�[r�f�9��n�S��Ѷ�[�>���<���,@�\^�k���Jz72��_ �F<D�Jb$E�D&!&:��n�.7�3�5���ܝ�-�[�n@#d���0��↵��(���% @*`�42��Rq9���n����]x�f��xw�h<����?���lBW�����4j@F��r�+0�W)�PD��=9�g&0�����g ��#ddj<"*=h�m�d渌@Z�k���t@�a��'�5Y�↵;�Z�MnwG�pG����"���!�X���I��{�%���↵G�*9↵��0SJpU�`� �zL�in�Ĥ���P4Ѥ�Cͱ�zT��Zs��0O����
,��o!�$�悽�0vk
��M@�X�̌����:�CY�)�Z b�=�3s�PBiL&�↵��*Z�'���G9/t�P§�աe�όd���(r�↵`H�nd��m�&TB+��dx4��,Z��>��ݷ�w#f�*ݨ3֦�6=H����[<Xi����m(7�8�cYM�f,��↵r�N_|����ꪸ]�8ͱ0��%�"���}�↵�{��C{߅��퇊�&��)���@�f�����@�5e�Ә+�O���X�,o��FN�#bDx7��A�!�C��q�e&�a|�^\�}f1Y1���c,�7F��)���,�c|f��qu����X'�0��Y3�9c��fFI�(�q���c&���ˉ��A↵�R('c�̕��YO��(�t�͌V�↵h�����^����↵+����A�"ʍ���DN lE��h�����%����1W���,Hf�̡_~�1a꾝���↵�tG�+���T_���_�;�c�W�y��q7��|����{f2>�#/��O��I��溞0s���y �Z6k�֘V���d��+W��K��Z^�n����c�2g�'q3vI�%�������9��Q!Z6�Rw�9�����g�V���������+"���2WV��bj�tyGZ���\Yr�fv����.�ɍjz2��j���V����9s'�u��\I\M���S�5W��d4�����S�tX���%t).�11�j0{�z� �� ;� ���ĸ�#�Ԅ��B\↵Țq�Y�h�Y�5 S���@��Pј|��t�HQ).*�TbV��¸엢�$�` �ha) ̦���#�L�°↵RE��.A�a<.$�3rkF�)�%�5�D���TV�Eԗ�5`L2�Xv* �QVc�CD�Ws�����Ф`Bq �)����;-x&f����31=��zX�Q))r�HL�A,x�z��{�wp�=c�c�3����]>�0<�<�;=6�w����z�&}� 1>I��X1��������3�9
LRBXLJ�A�$'� *"��C���:�f�X�����
�*�}%�G���\��@1Dh�
4j1�/��_� ��Fq�%H�T""AZ�²?�"�-�u����,؟%��%���rL�3�f�es�U�3#ޕ3PA�ªO�5I B��b��������e ↵j��&Q�Y��?�M�Z��e}au�$�%EE`�TU,q�����VX.D�s�g��e�Os�T1��R�겥�)6R���b1��&`�Y�2oTPY���↵�GV/�1�9h���T�ti�NM�h0�FV�o"�,s�T��ϾaCx6o��@�6���A��zs(�4��p%��,������'�>~�MȊ|՛���`y�#e*��-�����_%{�D��#�p>E��f�*�h�[7
�Iv��e�������bfY��⣸مW�J�t��gM���ٽ���ۖ�-my��]˛(I��Hw��q�!x���������%���:=↵#��� Ѻ2����{�v~'�{�c+��"��HM�iendstream↵endobj↵52 0 obj↵4034↵endobj↵50 0 obj↵<< /Type /Font↵/Subtype /CIDFontType2↵/BaseFont /FreeSans↵/CIDSystemInfo << /Registry (Adobe) /Ordering (Identity) /Supplement 0 >>↵/FontDescriptor 48 0 R↵/CIDToGIDMap /Identity↵/W [0 [804 774 224 432 496 258 552 488 480 655 224 475 563 641 ]↵]↵>>↵endobj↵51 0 obj↵<< /Length 475 >>↵stream↵/CIDInit /ProcSet findresource begin↵12 dict begin↵begincmap↵/CIDSystemInfo << /Registry (Adobe) /Ordering (UCS) /Supplement 0 >> def↵/CMapName /Adobe-Identity-UCS def↵/CMapType 2 def↵1 begincodespacerange↵<0000> <FFFF>↵endcodespacerange↵4 beginbfrange↵<0000> <0000> <0000>↵<0001> <0004> [<0916> <093F> <0930> <0926> ]↵<0006> <0007> [<092F> <0935> ]↵<0009> <000D> [<0925> <093E> <092A> <0928> <0936> ]↵endbfrange↵endcmap↵CMapName currentdict /CMap defineresource pop↵end↵end↵endstream↵endobj↵15 0 obj↵<< /Type /Font↵/Subtype /Type0↵/BaseFont /FreeSans↵/Encoding /Identity-H↵/DescendantFonts [50 0 R]↵/ToUnicode 51 0 R>>↵endobj↵2 0 obj↵<<↵/Type /Pages↵/Kids ↵[↵5 0 R↵]↵/Count 1↵/ProcSet [/PDF /Text /ImageB /ImageC]↵>>↵endobj↵xref↵0 53↵0000000000 65535 f ↵0000000009 00000 n ↵0000067778 00000 n ↵0000000241 00000 n ↵0000000336 00000 n ↵0000031671 00000 n ↵0000000373 00000 n ↵0000001304 00000 n ↵0000001323 00000 n ↵0000001743 00000 n ↵0000001762 00000 n ↵0000031599 00000 n ↵0000045555 00000 n ↵0000047096 00000 n ↵0000054537 00000 n ↵0000067643 00000 n ↵0000049049 00000 n ↵0000062362 00000 n ↵0000031621 00000 n ↵0000032064 00000 n ↵0000034464 00000 n ↵0000031792 00000 n ↵0000032044 00000 n ↵0000034485 00000 n ↵0000034688 00000 n ↵0000044309 00000 n ↵0000044723 00000 n ↵0000044288 00000 n ↵0000045691 00000 n ↵0000045900 00000 n ↵0000046448 00000 n ↵0000046660 00000 n ↵0000046428 00000 n ↵0000047238 00000 n ↵0000047501 00000 n ↵0000048408 00000 n ↵0000048630 00000 n ↵0000048388 00000 n ↵0000049189 00000 n ↵0000049449 00000 n ↵0000053875 00000 n ↵0000054101 00000 n ↵0000053854 00000 n ↵0000054674 00000 n ↵0000054939 00000 n ↵0000061430 00000 n ↵0000061758 00000 n ↵0000061409 00000 n ↵0000062504 00000 n ↵0000062708 00000 n ↵0000066853 00000 n ↵0000067117 00000 n ↵0000066832 00000 n ↵trailer↵<<↵/Size 53↵/Info 1 0 R↵/Root 18 0 R↵>>↵startxref↵67876↵%%EOF↵"
查询引擎正在尝试查找
IN('58,59,60,61,62,63,64,65,66,67,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,86,87,88,89,90,91,92,93,94,95,96,97,98,99,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155')
作为一个字符串。虽然您拥有所有这些ID,但它们可以单独使用,而不是作为连接字符串使用。
删除括号内的'58,59,60,61,62,63,64,65,66,67,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,86,87,88,89,90,91,92,93,94,95,96,97,98,99,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155'
,它应该可以正常工作。
答案 3 :(得分:0)
SELECT *
FROM invoice
WHERE `ID` IN(58,59,60,61,62,63,64,65,66,67,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,86,87,88,89,90,91,92,93,94,95,96,97,98,99,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155)
答案 4 :(得分:0)
在您的查询中,您要检查字符串'ID'
是否在该列表中,
并且您想要检查天气列ID
的值是否与列表项匹配。为此你需要传递ID
并列出没有引号的值,引号使它成为字符串文字所以使用,
SELECT *
FROM invoice
WHERE ID IN(58,59,60,61,62,63,64,65,66,67,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,86,87,88,89,90,91,92,93,94,95,96,97,98,99,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155)