SELECT d.*, dv.id AS version_id FROM docs AS d INNER JOIN docs_versiones AS dv ON dv.doc_id = d.id WHERE dv.app_id = '2' AND (d.id = 'tutoriales' OR d.slug = 'tutoriales') AND (dv.id = 'v1' OR dv.version = 'v1')