SELECT p.*, IF(LENGTH(fotos)>10,0,(SELECT id FROM w229_post_fotos WHERE post=p.id ORDER BY principal DESC, id LIMIT 1)) AS fotoGal FROM w229_post AS p WHERE p.id=21064 LIMIT 1
O Documento -