From: Martijn Tonies Date: April 25 2006 10:06am Subject: Re: Top N selections + rest row List-Archive: http://lists.mysql.com/mysql/197300 Message-Id: <084601c6684f$fedc8dd0$cd02a8c0@martijnws> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Hi, >Anybody with smart ideas to get Top-N rows plus the rest row ? >Suppose I have ranked sales values descending for 2005, like: >Select Country, Sum(Sales) AS Sales From myTable >Where Year=2005 Group By Country >Order By Sales DESC LIMIT 25; > >Then I get Top-25 sales rows, but I also want a rest row, >where all 26 rows represent the world total. >I'm using MySQL 5.0.15. What about just removing the LIMIT clause? Or, alternatively, do a skip of the first 25 rows? (check the docs for that) Do you want to get this in a single result, or additional result? Martijn Tonies Database Workbench - development tool for MySQL, and more! Upscene Productions http://www.upscene.com My thoughts: http://blog.upscene.com/martijn/ Database development questions? Check the forum! http://www.databasedevelopmentforum.com