Suponiendo que tengo 2 mesasGROUP_CONCAT con JOINLEFT en Zend Db Seleccionar
articles
id title
1 Article 1
2 Article 2
Images
id article_id image
1 1 a.png
2 1 b.png
3 2 c.png
4 2 d.png
Todo lo que quiero es retreive todos los artículos con sus imágenes.
Por ejemplo:
article_id title images
1 Article 1 a.png, b.png
2 Article 2 c.png, d.png
¿Cómo podría hacer eso con Zend_Db_Select?
I intentado algo así, pero no tuvo suerte:
$select = $this->getDbTable()->select()->setIntegrityCheck(false)->distinct();
$select->from(array('a'=>'articles'))
->joinLeft(array('i'=>'images'),'i.article_id=a.id',array('images'=> new
Zend_Db_Expr('GROUP_CONCAT(i.image)')));
Devuelve sólo sólo 1 fila qué campo 'imágenes' contiene imágenes de ambos artículos.
article_id title images
1 Article 1 a.png, b.png, c.png, d.png
¿Qué estoy haciendo mal aquí?
¿Dónde está cláusula group by? –