Alternatively create a "range" table, insert your defined ranges and 
join/subquery to the original query.

Create table range (label text, from integer, to integer);

-----Ursprüngliche Nachricht-----
Von: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] Im 
Auftrag von Simon Slavin
Gesendet: Mittwoch, 08. März 2017 14:53
An: SQLite mailing list <sqlite-users@mailinglists.sqlite.org>
Betreff: Re: [sqlite] SQL help: by-range aggregation


On 8 Mar 2017, at 1:46pm, Dominique Devienne <ddevie...@gmail.com> wrote:

> I'd like to aggregate the sum of the size per-parent, from 1KB, to
> each range from low to 8*low (i.e. [low, 8*low)), but w/o having to
> write my hand all possible combination, with extra points for
> formatting the range bounds in KB, MB, GB as appropriate.

Does your programming language allow you to implememnt a SQLite external 
function which takes a value and returns a string indicating which range its in 
?

This would allow you to implement triggers on INSERT and UPDATE which 
automatically set a 'category' field in the table.  Then you could filter on 
value, or use GROUP BY, or other things.

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


___________________________________________
 Gunter Hick
Software Engineer
Scientific Games International GmbH
FN 157284 a, HG Wien
Klitschgasse 2-4, A-1130 Vienna, Austria
Tel: +43 1 80100 0
E-Mail: h...@scigames.at

This communication (including any attachments) is intended for the use of the 
intended recipient(s) only and may contain information that is confidential, 
privileged or legally protected. Any unauthorized use or dissemination of this 
communication is strictly prohibited. If you have received this communication 
in error, please immediately notify the sender by return e-mail message and 
delete all copies of the original communication. Thank you for your cooperation.


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

Reply via email to