select g.*, as gallery_year_id, yd.descr as year_descr
                                             from gallery g left join gallery_year_group yg on = yg.gallery_id
                                                                          left join gallery_year y on yg.gallery_year_id =
                                                                          left join gallery_year_descr yd on = 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
                                             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