library(RMySQL) library(tidyverse) library(animation) yhendus<-dbConnect(dbDriver("MySQL"), user='mart', password='ajutine1234', host='localhost', dbname='mart' ) paring<-dbSendQuery(yhendus, " SELECT title, COUNT(*) AS filmikogus FROM (SELECT efis_film_type_translation.title, COUNT(*) AS naitlejaid, efis_film.id AS filmi_id FROM efis_film JOIN efis_film_type_rel ON efis_film_type_rel.film_id=efis_film.id JOIN efis_film_type ON efis_film_type_rel.film_type_id=efis_film_type.id JOIN efis_film_type_translation ON efis_film_type_translation.film_type_id=efis_film_type.id AND efis_film_type_translation.language='et' JOIN efis_film_role_person ON efis_film_role_person.film_id=efis_film.id WHERE efis_film_type.id IN (33, 6, 56) GROUP BY efis_film.id HAVING COUNT(*)>1 AND COUNT(*)<20) AS tabel1 GROUP BY title ") andmed=fetch(paring, n=-1) #andmed=andmed %>% filter(kymnend>=1910 & kymnend<=2010) andmed