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

      • <bdo id='Hr3t3'></bdo><ul id='Hr3t3'></ul>
    1. <tfoot id='Hr3t3'></tfoot><legend id='Hr3t3'><style id='Hr3t3'><dir id='Hr3t3'><q id='Hr3t3'></q></dir></style></legend>

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

      Mysql 选择不同

      Mysql select distinct(Mysql 选择不同)

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

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

            • <legend id='yncVl'><style id='yncVl'><dir id='yncVl'><q id='yncVl'></q></dir></style></legend>

              1. <i id='yncVl'><tr id='yncVl'><dt id='yncVl'><q id='yncVl'><span id='yncVl'><b id='yncVl'><form id='yncVl'><ins id='yncVl'></ins><ul id='yncVl'></ul><sub id='yncVl'></sub></form><legend id='yncVl'></legend><bdo id='yncVl'><pre id='yncVl'><center id='yncVl'></center></pre></bdo></b><th id='yncVl'></th></span></q></dt></tr></i><div id='yncVl'><tfoot id='yncVl'></tfoot><dl id='yncVl'><fieldset id='yncVl'></fieldset></dl></div>
                本文介绍了Mysql 选择不同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我正在尝试选择 mysql 表中的重复行,它对我来说工作正常,但问题是它不允许我选择该查询中的所有字段,只是让我选择我用作不同的字段名称,让我编写查询以更好地理解

                I am trying to select of the duplicate rows in mysql table it's working fine for me but the problem is that it is not letting me select all the fields in that query , just letting me select the field name i used as distinct , lemme write the query for better understading

                mysql_query("SELECT DISTINCT ticket_id FROM temp_tickets ORDER BY ticket_id")
                
                mysql_query("SELECT * , DISTINCT ticket_id FROM temp_tickets ORDER BY ticket_id")
                

                第一个工作正常

                现在当我尝试选择所有字段时,我最终遇到了错误

                now when i am trying to select all fields i am ending up with errors

                我正在尝试选择最新的重复项,比如说,ticket_id 127 在行 id 7,8,9 上出现了 3 次,所以我想用最新的条目选择一次,在这种情况下为 9,这适用于所有其余的ticket_id

                i am trying to select the latest of the duplicates let say ticket_id 127 is 3 times on row id 7,8,9 so i want to select it once with the latest entry that would be 9 in this case and this applies on all the rest of the ticket_id's

                任何想法谢谢

                推荐答案

                您在寻找 "SELECT * FROM temp_tickets GROUP BY ticket_id ORDER BY ticket_id 吗?

                更新

                SELECT t.* 
                FROM 
                (SELECT ticket_id, MAX(id) as id FROM temp_tickets GROUP BY ticket_id) a  
                INNER JOIN temp_tickets t ON (t.id = a.id)
                

                这篇关于Mysql 选择不同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                相关文档推荐

                ibtmp1是非压缩的innodb临时表的独立表空间,通过innodb_temp_data_file_path参数指定文件的路径,文件名和大小,默认配置为ibtmp1:12M:autoextend,也就是说在文件系统磁盘足够的情况下,这个文件大小是可以无限增长的。 为了避免ibtmp1文件无止境的暴涨导致
                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 按组最频繁)
                Why Mysql#39;s Group By and Oracle#39;s Group by behaviours are different(为什么 Mysql 的 Group By 和 Oracle 的 Group by 行为不同)
                MySQL GROUP BY DateTime +/- 3 seconds(MySQL GROUP BY DateTime +/- 3 秒)

              2. <tfoot id='sr1jh'></tfoot>
                    <bdo id='sr1jh'></bdo><ul id='sr1jh'></ul>

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

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

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