Dominique Devienne wrote:
> On Wed, Mar 8, 2017 at 3:16 PM, Hick Gunter <h...@scigames.at> wrote:
>> Alternatively create a "range" table, insert your defined ranges and
>> join/subquery to the original query.
>
> That's the easy part [...]
> but the join/subquery you mention is still leaving me scratching my head...

  WITH u(v) AS (
    SELECT sum(s)
    FROM t
    GROUP BY p
  )
  SELECT ranges.name,
         u.v
  FROM u
  JOIN ranges ON u.v >= ranges.low
             AND u.v <  ranges.high;

name           v
-------------  ------
[0, 1KB)       904
[8KB, 64KB)    36000
[64KB, 512KB)  370368


Regards,
Clemens
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to