in reply to How to add columns with new row name using perl from mysql query?

Just change the query to
SELECT * FROM ( SELECT queue_name, jobs_pend, jobs_run FROM queues ORDER BY queue_name LIMIT 5 ) UNION ALL SELECT 'others', SUM(jobs_pend), SUM(jobs_run) FROM ( SELECT jobs_pend, jobs_run FROM queues ORDER BY queue_name LIMIT 18446744073709551615 OFFSET 5 )

Note: Tested only in SQLite, but it seems the LIMIT syntax is the same as in MySQL according to a cursory glance at the documentation. (Well, in fact, the large number has to be lower in SQLite, but MySQL documentation shows this constant).

($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,

Replies are listed 'Best First'.
Re^2: How to add columns with new row name using perl from mysql query?
by perlanswers (Initiate) on Apr 03, 2017 at 08:46 UTC
    Hi,
    why you had included limit range so long?
      Because you want to sum over all the remaining rows, but you don't know their number. So I used the maximal possible number of rows, as shown in the documentation.

      ($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,
        Offset without limit ?