hi, I am using a MySQL INNER JOIN statement which returns various results for one distinct record in the main table from the joins, similar to http://stackoverflow.com/questions/1038653/how-to-join-multiple-joins-yet-return-distinct-values My query is
SELECT cl.*, dep.dept_name
FROM epapers.clientelle cl
INNER JOIN epapers.dept_staff_users depu
ON depu.user_id=cl.user_id
INNER JOIN epapers.dept dep
ON dep.dept_id=depu.dept_id
group by cl.user_id
ORDER BY cl.user_name ASC,
I would like to display the above in a table shown below
echo "<tr bgcolor='#CCCCCC'>
<td >$num</td><td >".$row[user_id]."</td><td>".$row[user_name]."</td>
<td >".$row[fname]."</td><td >".$row[lname]."</td>
<td >".$row[dept_name]."</td>
<td >".$row[dept_name]."</td>
<td >".$row[dept_name]."</td>
<td >".$row[email]."</td>";
$TrID = "$row[user_id]";
echo "<td >";
echo '<form name="activate" action="activate_acc.php" method="POST" ;">';
echo "<input type='hidden' name='TrID' value='$TrID'>";
echo "<input type='checkbox' name='active' value='$row[active]'>";
echo '<input type="submit" name="Submit" value="Delete">';
echo '</form>';
echo "</td >";
...
Note the the departments can be upto 3 departments. How do I return the mysql query results in a single row for the departments?