Один из вариантов.
SELECT projects.*, (SELECT COUNT(pictures.id) FROM pictures WHERE pictures.id=projects.id) AS count_pic FROM projects ORDER BY count_pic DESC
_____________
Mysql, Postgresql, Redis, Memcached, Unit Testing, CI, Kohana, Yii, Phalcon, Zend Framework, Joomla, Open Cart, Ymaps, VK Api