SELECT SQL_CALC_FOUND_ROWS soc.id, soc.id, soc.name AS name, soc.latitude, soc.longitude, soc.id_state_category,soc.update_time,soc.new_state,soc.has_image
FROM smtbl_societes soc
JOIN smtbl_societes_categories sc ON (soc.id=sc.id_society AND sc.id_category=6)
WHERE
(soc.id_address_city=147849 OR soc.id_address_city IN (SELECT id FROM smtbl_address_cities WHERE id_district_parent=147849)) AND soc.deleted!=1
ORDER BY soc.has_image DESC,update_time DESC
LIMIT 0, 15