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

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

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

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

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

      如何使用mysql将查询结果存储在变量中

      时间:2023-10-09

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

              <legend id='ac5gF'><style id='ac5gF'><dir id='ac5gF'><q id='ac5gF'></q></dir></style></legend>
                <tbody id='ac5gF'></tbody>

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

                本文介绍了如何使用mysql将查询结果存储在变量中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                SET @v1 := SELECT COUNT(*) FROM user_rating;
                SELECT @v1
                

                当我使用 set 变量执行此查询时,会显示此错误.

                When I execute this query with set variable this error is shown.

                Error Code : 1064
                You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use
                near 'SELECT count(*) FROM user_rating' at line 1
                
                Execution Time : 00:00:00:000
                Transfer Time  : 00:00:00:000
                Total Time     : 00:00:00:000
                
                (1 row(s) returned)
                Execution Time : 00:00:00:343
                Transfer Time  : 00:00:00:000
                Total Time     : 00:00:00:343
                

                推荐答案

                用括号括起来的选择.

                SET @v1 := (SELECT COUNT(*) FROM user_rating);
                SELECT @v1;
                

                这篇关于如何使用mysql将查询结果存储在变量中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:为什么 SQL Server 会将两个整数相除的结果四舍五入? 下一篇:Python 和 Django OperationalError(2006,'MySQL 服务器已经消失'

                相关文章

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