SELECT count(*)
											FROM `gallery_data_variants` AS gdv
											RIGHT JOIN `gallery_data_category_link` AS gdcl ON (gdcl.`id_identification` = gdv.`static_identification`)
											WHERE gdv.`id` != 0
											     AND `id_tree` = '39'