我有这个查询(和结果):
select articles.article_id, articles.article_text, article_photos.photo_filename
from
articles
left join article_photos
on article_photos.article_id=articles.article_id
>>> results
1,some_text,photo1.jpg
1,some_text,photo2.jpg
1,some_text,photo3.jpg
如何将 GROUP_CONCAT 合并到其中,以便获得:
>>> results
1,some_text,photo1.jpg
NULL,NULL,photo2.jpg
NULL,NULL,photo3.jpg
基本上,我有一个带有文章的表格,以及带有图像的相关表格。一篇文章可以有多个属于它的图像,所以我试图在 while 循环内将它打印在屏幕上,并且不希望文本在有多个图像时一遍又一遍地重复。