我想從數據庫中獲取數據使用PHP
這個Sql請求你會看到我有3個表,但在表Milestoneevent
我有不同的值列libelle
所以我想顯示像這樣加入表格顯示沒有重複
標識NUM libelle1 libelle2 libelle3 ..... SQL reql要求和PHP
select DISTINCT file.num,file.id as filenumber,file.numlta,milestones.id,milestones.libelle,milestoneevent.idmilestone,milestoneevent.dat,milestoneevent.idfile from file,milestones,milestoneevent where milestoneevent.idfile=FILE.num and milestoneevent.idmilestone=milestones.id
while (row=mysqlfetchassoc(
rs_result)) {
//print_r($row); // debug code ?>
<tr>
<td><input type='checkbox' name="approve[]" id="check" value=<?php echo $row['num']?>></td>
<td><?php echo $row['filenumber']; ?></td>
<td><?php echo $row['numlta']; ?></td>
<td><?php echo $row['designation']; ?></td>
<td><?php echo $row['libelle']; ?></td>
<td><?php echo $row['milestonedate']; ?></td>
</tr>
在圖片中你看到了一排cqn
在不同的日期
編輯
爲libelle
列多個值作爲意見中的要求,這是我期望的輸出:
我不得不在這裏添加圖片評論中討論導致不能添加它
'BY libelle'(或領域,你想成爲唯一的)GROUP也許 ? – Gogol
我不知道你在做什麼。你能否提供你的樣本數據的預期輸出? – Shadow
預期數據顯示 49 A2006/0324 --- 1 --Exemption ..- 1 --- 2016-03-03-49 50 A2006/0327 --- 1 --Exemption ..- 1 --- 2016-03-03-49 51 A2006/0325 --- 1 --Exemption ..- 1 --- 2016-03-03-49 7 A2006/0325 --- 1 - 豁免CA ..- 1 --- 2016-03-03-49 多數民衆贊成 只需添加其他libelle像客戶端retourned豁免函 – user2128925