我使用GROUP_CONCAT子句对属于特定更新的模型的名称进行分组。例如,更新A具有模型1和模型2.每个模型都有自己的传记页面。但是,由于我使用GROUP_CONCAT子句,模型1和模型2链接都转到相同的传记页面。 而不是:
<a href="bio.php?model_id=1"> model 1 , model 2 </a>
我想要这个结果:
<a href="bio.php?model_id=1"> model 1 </a> , <a href="bio.php?model_id=2"> model 2</a>
这是SQL:
SELECT updates.update_id, title, posted, duration, updates.thumbnail, updates.alt_tag, updates.title_tag, updates.visible, models.model_id,
GROUP_CONCAT(CONCAT(' ', first_name, ' ', last_name, ' ')) AS full_name
FROM updates, models, updates_models
WHERE updates.update_id = updates_models.update_id AND models.model_id = updates_models.model_id
GROUP BY updates.update_id, title, posted, duration, updates.thumbnail, updates.alt_tag, updates.title_tag, updates.visible