GROUP BY mesicedit: nechce se mi to vypisovat, přečti si to tady: http://interval.cz/clanky/sql-dotazy-s-agregaci/