我有三个表的内连接:
$result=mysql_query("SELECT singleimageupload.codrif AS codrif,
singleimageupload.imagesname AS bigimage,
uploads.imagesname AS multipleimage,
uploads.description AS multipledescription,
exposition.name,
exposition.author,
exposition.description,
exposition.misure,
exposition.date,
exposition.status
FROM exposition
INNER JOIN singleimageupload ON singleimageupload.codrif = exposition.codrif
INNER JOIN uploads ON uploads.codrif = exposition.codrif
WHERE singleimageupload.firstimage = 'first' AND exposition.codrif = 'A002'
ORDER BY exposition.codrif");
在这种情况下,我有每个上传路径的结果。
所以,我想合并他们的Cod Rif的所有上传路径(在这个例子中,A002)。
这是我的完整代码:
<?php
include('guestconfig/config.php');
$result=mysql_query("SELECT singleimageupload.codrif AS codrif,
singleimageupload.imagesname AS bigimage,
uploads.imagesname AS multipleimage,
uploads.description AS multipledescription,
exposition.name,
exposition.author,
exposition.description,
exposition.misure,
exposition.date,
exposition.status
FROM exposition
INNER JOIN singleimageupload ON singleimageupload.codrif = exposition.codrif
INNER JOIN uploads ON uploads.codrif = exposition.codrif
WHERE singleimageupload.firstimage = 'first' AND exposition.codrif = 'A002'
ORDER BY exposition.codrif");
while ($row = mysql_fetch_assoc($result)) {
?>
<table border="0">
<tr>
<td> <?php echo $row['codrif']?> </td>
</tr>
<tr>
<td> <?php echo $row['bigimage']?> </td>
</tr>
<tr>
<td> <?php echo $row['name']?> </td>
</tr>
<tr>
<td> <?php echo $row['author']?> </td>
</tr>
<tr>
<td> <?php echo $row['multipledescription']?> </td>
</tr>
<hr>
</table>
<?php } ?>
我不知道我是否明确解释过,我希望如此
答案 0 :(得分:1)
尝试使用group_concat(uploads.description)并通过singleimageupload.codrif分组