Running this query it will create a table with 3 columns (place name, id of vaccines and the count of how many the vaccines were applied to different persons).
select vaccines.placename, vaccinetype.idvaccine,count(*)
from vaccines,request,vaccinetype
where request.idvaccine = vaccines.idvaccine
and vaccinetype.idvaccine = request.idvaccine
group by vaccines.placename,vaccinetype.idvaccine
order by vaccines.placename, vaccinetype.idvaccine
In the image of the query result above, you will see that the same vaccine id was applied in different places but this is something that i want to filter, i want to only show those vaccines id where was the most applied to the persons. For example, in this table we would have to eliminate row 6 because row 1 already exists with the same vaccine code and also that in the column count (*) the value is higher than row 6.
I have tried to do a sub query but it didn't filter correctly.