1. <small id='sZnKj'></small><noframes id='sZnKj'>

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

      <tfoot id='sZnKj'></tfoot>

      1. 在 MYSQL 的子查询中使用 LIMIT 关键字的替代方法

        Alternative to using LIMIT keyword in a SubQuery in MYSQL(在 MYSQL 的子查询中使用 LIMIT 关键字的替代方法)

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

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

                  <tfoot id='8dHtq'></tfoot>
                  本文介绍了在 MYSQL 的子查询中使用 LIMIT 关键字的替代方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有一个包含以下列的表 TEST:

                  I have a table TEST with the following columns :

                  code_ver (VARCHAR)
                  suite (VARCHAR)
                  date (DATE)
                  

                  现在我想选择具有不同值 code_ver & 的 10 行code_ver NOT LIKE '%DevBld%' 按日期降序排序.

                  Now I want to select 10 rows with a distinct value of code_ver & code_ver NOT LIKE '%DevBld%' sorted by date desc.

                  所以我写了以下查询:

                  select * 
                    from test 
                   where code_ver IN (select DISTINCT code_ver 
                                        from test 
                                       where code_ver NOT LIKE '%DevBld%' 
                                       ORDER by date DESC LIMIT 10);
                  

                  这个查询应该可以正常工作,但我的 MySQL 版本说:

                  This query should ideally work, but my version of MySQL says :

                  此版本的 MySQL 尚不支持 'LIMIT &在/所有/任何/一些子查询'

                  This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'

                  有人可以建议我替代此查询吗?

                  Can someone suggest me an alternative to this query?

                  推荐答案

                  你得到的错误并不完全是因为 MySQL 的版本.我认为所有版本都支持.您必须更改 LIMIT 10 位置并将其放在)"之后.请让我知道这对你有没有用.我在我的上运行了波纹管,它工作正常.

                  The error you are getting is not exactly because of the version of MySQL. I think all versions support that. You have to change the LIMIT 10 place and place it after ")". Let me know if it works for you. I ran the bellow one on mine and it works.

                  例如

                  SELECT * FROM test where name IN (
                             SELECT DISTINCT name 
                             FROM projects 
                             WHERE name NOT LIKE "%DevBld%"  
                             ORDER by date_created DESC
                   ) LIMIT 10;
                  

                  更新:试试下面的一个,这样顺序就行了:

                  Update: Try the one below, this way order would work:

                   SELECT * FROM  automation.e2e_projects WHERE name IN (
                         SELECT DISTINCT name 
                         FROM automation.e2e_projects
                         WHERE name NOT LIKE "%DevBld%"
                   ) ORDER by date_created DESC LIMIT 10;
                  

                  这篇关于在 MYSQL 的子查询中使用 LIMIT 关键字的替代方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  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='HNcrw'><tr id='HNcrw'><dt id='HNcrw'><q id='HNcrw'><span id='HNcrw'><b id='HNcrw'><form id='HNcrw'><ins id='HNcrw'></ins><ul id='HNcrw'></ul><sub id='HNcrw'></sub></form><legend id='HNcrw'></legend><bdo id='HNcrw'><pre id='HNcrw'><center id='HNcrw'></center></pre></bdo></b><th id='HNcrw'></th></span></q></dt></tr></i><div id='HNcrw'><tfoot id='HNcrw'></tfoot><dl id='HNcrw'><fieldset id='HNcrw'></fieldset></dl></div>
                      <legend id='HNcrw'><style id='HNcrw'><dir id='HNcrw'><q id='HNcrw'></q></dir></style></legend>
                    • <small id='HNcrw'></small><noframes id='HNcrw'>

                            <bdo id='HNcrw'></bdo><ul id='HNcrw'></ul>
                              <tbody id='HNcrw'></tbody>
                          • <tfoot id='HNcrw'></tfoot>