I tried.
Then I get:
###
person_idpoints
1 34
2 49
2 46
2 37
3 42
3 35
3 24
instead of desired:
person_idpoints
1
Change the > to >= and the < to <= to deal with this.
Baron
Miroslav Monkevic wrote:
Thanks Baron, great advice (as always).
My real query is a bit more complicated but speaking in terms of example
I provided, I took this path:
create table results
(
person_id int(11),
Thanks Baron, great advice (as always).
My real query is a bit more complicated but speaking in terms of example
I provided, I took this path:
create table results
(
person_id int(11),
points int(11)
);
insert into results values(1, 34);
insert into results values(1, 33
Miroslav
>My goal is to sum 7 greatest results for each person.
Have a look at 'Within-group quotas (Top N per group)' at
http://www.artfulsoftware.com/infotree/queries.php.
PB
-
Miroslav Monkevic wrote:
Hello,
MySQL 4.1
I have query:
SELECT SUM(points) as ranking FROM results GROUP
Hi,
Miroslav Monkevic wrote:
Hello,
MySQL 4.1
I have query:
SELECT SUM(points) as ranking FROM results GROUP BY person_id ORDER BY
ranking DESC
My goal is to sum 7 greatest results for each person.
In more general, my question is: is there a way to limit number of
records within groups i
Hello,
MySQL 4.1
I have query:
SELECT SUM(points) as ranking FROM results GROUP BY person_id ORDER BY
ranking DESC
My goal is to sum 7 greatest results for each person.
In more general, my question is: is there a way to limit number of
records within groups in "group by" query.
Thank yo