table com
id | com | id_status
1 testing 1 1
2 testing 2 1
3 testing 3 2
4 testing 4 2
table update
id_status | update
1 update 1
2 update 2
3 update 3
SELECT `update`.`update`, `com`.`com` as comen
FROM `update`
LEFT JOIN `com` ON `update`.`id_status`=`com`.`id_status`
it results :
update 1
testing 1
update 1
testing 2
update 2
testing 3
update 2
testing 4
the update table results duplicate
i've done using group by update
.id_status
, it results :
update 1
testing 1
testing 2
update 3
the table com only resut 1 row
EDIT--
i got syntax from this MySQL LEFT JOIN display duplicate rows
$first = true;
while($row = $query->fetch_object()){
if($first){
echo $row->update;
$first = false;
echo "<br>";
}
echo $row->comen;
echo "<br>";
}
update 1
testing 1
testing 2
testing 3
testing 4
it fetch only 1 table row
i want the results looks like this :
update 1
testing 1
testing 2
update 2
testing 3
testing 4
update 3
...
--
how the right syntax work or maybe the query?