<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将查询结果存储在变量中

      How to store Query Result in variable using mysql(如何使用mysql将查询结果存储在变量中)

          • <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将查询结果存储在变量中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                相关文档推荐

                How to update a record using sequelize for node?(如何使用节点的 sequelize 更新记录?)
                How to provide a mysql database connection in single file in nodejs(如何在 nodejs 中的单个文件中提供 mysql 数据库连接)
                Looping Over Result Sets in MySQL(在 MySQL 中循环结果集)
                What are the advantages of VistaDB(VistaDB有什么优势)
                SQLite insert speed slows as number of records increases due to an index(SQLite 插入速度随着索引数量的增加而变慢)
                sqlite select with condition on date(sqlite 选择日期条件)

                <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>
                      • <small id='DhkDj'></small><noframes id='DhkDj'>

                            <tbody id='DhkDj'></tbody>