sql=SELECT u.unitname, c.*, (SELECT count(*) FROM files as f WHERE f.catalog='culture' and f.catalog_id=c.id) as files_cnt FROM culture as c, units as u WHERE c.culture='1' and c.unit_code = u.code and year(c.date_beg) = ? ORDER BY c.date_beg ASC