Re: limit 5 iclouding also all the equals value with the 5th

From: Kostas Konstantinidis <kost36_at_gmail.com>
Date: Sat, 14 Oct 2017 09:04:47 -0700 (PDT)
Message-ID: <68aaff96-d2be-4f92-b362-2d7126323399_at_googlegroups.com>


[Quoted] Dear The Natural Pholisopher and Jerry,

while trying to make all of your suggestions I got a new idea not really so complicate... To work with GROUP_CONCAT on persons and the total of films for each record and then limit to n So i used

SELECT

        GROUP_CONCAT(`st_peoplefilms`.`ID_person`
            SEPARATOR ', ') AS `person`,
        COUNT(st_peoplefilms`.`ID_films`) AS `total`
    FROM
        `st_peoplefilms`
    WHERE
        (`st_peoplefilms`.`ID_idiotita` = 29)
    GROUP BY `st_peoplefilms`.`ID_person`     ORDER BY `total` DESC
LIMIT 5 it should return
person CountOfID_films
1            100 
2             95 
3             70 
4             68 

5, 6, 7, 8 65

but it returns just the same as my 1st topic

thank's Received on Sat Oct 14 2017 - 18:04:47 CEST

Original text of this message