select g.*, y.id as gallery_year_id, yd.descr as year_descr
                                             from gallery g left join gallery_year_group yg on g.id = yg.gallery_id
                                                                          left join gallery_year y on yg.gallery_year_id = y.id
                                                                          left join gallery_year_descr yd on g.id = yd.gallery_id and yg.gallery_year_id = yd.gallery_year_id
                                             where g.gallery_type_id = 
                                               and y.year = 2020
                                               and yg.is_visible = 1
                                               and g.is_visible = 1
                                             group by g.id
                                             order by g.title
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'and y.year = 2020 and yg.is_visib' at line 6

/galerie/showGalleryType.php