SELECT `references`.*, `pictures`.`thumbnail`, `pictures`.`file` as `picture`, CONCAT(Seo_Url(`reference_title`), '/', `references`.`id`) as `seo_name` FROM `references` LEFT JOIN `pictures` ON `pictures`.`table`='references' AND `item_id`=`references`.`id` AND `default_pic`=1 WHERE `references`.`id`='20'