Hello,

I have a query where I wish to limit the number of rows in the result per
group, but not limit them overall.

So for example if I have a table Intable

Create Table Intable (ID Integer Primary Key, Grp Integer, .....other
stuff.....);

And I fill Intable with lots of records, with a few different values of Grp,
so there may be 30 with grp=1, 3 with grp=7, 18 with grp=4.

I would like to select up to a limited number of records for each value of
grp, say 10.
In the above example I would therefore like 10 with grp=1,  all 3 with
grp=7, and 10 with grp=4.

The LIMIT clause in a select seems to limit the total number of responses,
which I do not wish to do. I can't get it to act on a 'Group By' clause.

My reason is to perform physical communications measurements on devices
(each ID), but I can only handle a limited number of measurements within a
group at one time, but as many simultaneous groups as there are. I will then
mark these IDs as done, and go on to the next lot until they are all done.

Paul Hilton

_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to