3
I have to search in a table data of an advertiser, I need to group by the advertiser according to the most viewed, separated by the date.
I wanted to limit the group by, has as? 
Example table:
id       visualizacoes       data
485            19            20/05/2105
485            68            11/03/2105
121            45            05/04/2105
485            20            20/05/2105
370            37            26/05/2105
225            81            20/05/2105
485            75            07/03/2105
485            11            20/05/2105
485            46            20/05/2105
370            23            16/04/2105
370            15            09/05/2105
121            7             21/04/2105
680            10            20/05/2105
370            68            26/05/2105
370            92            26/05/2105
I want to group by id_anunciante and add up the views with the same date, but wanted to limit up to 3 registrations per advertiser.
Initial query:
SELECT *, SUM(visualizacoes) AS total_visu 
FROM anunciante 
GROUP BY id,data
Post the query you already developed to fetch this data
– Marciano.Andrade
this query brings the right result, for example id 485 has 4 records of the day 20/05/2015 want only 3. So of 3 in 3 ids.
– Rafael
I think it can be solved with a simple query. But it’s not entirely clear to me what you want. You have shown how your table is, if in the same way you show how the SELECT result would look I can offer an answer.
– Caffé
Okay Caffé, in my result, brings everything grouped by date and adding the views ,right, so assuming that the table brought 20 results, of these 5 are from id 485, then in this case I want it to be only 3 records, understood?
– Rafael
@Rafael Yes, I understand. And we already have an answer accepted :-)
– Caffé