database - MySQL - Display multiple rows in one field (tables with inner joins)q -


i have mysql database 3 tables, 1 table called fixturechannels, 1 called footballfixtures, , 1 called satellite.

basically satellite table contains information satellite channels (name, country, channelid), footballfixtures contains (matchid, hometeam, awayteam, competition....), , fixturechannels table containing (matchid, , channelid, these linked foriegn keys satellite , footballfixtures table respectively).

below further details on tables:

tablelayouts

i used following query below, , worked, able echo details need table

"select * fixturechannels inner join footballfixtures on fixturechannels.matchid=footballfixtures.matchid inner join satellite on fixturechannels.channelid=satellite.channelid"; 

the code used echoing details is:

 <tbody><tr>             <th>match id</th>             <th>home team</th>             <th>away team</th>             <th>competition</th>             <th>date</th>             <th>time</th>             <th>channel id</th>             <th>channel name</th>                   </tr>                 <?php foreach ($results $res) { ?>                 <tr>                <td><?php echo $res["matchid"]; ?></td>                <td><?php echo $res["hometeam"]; ?></td>                <td><?php echo $res["awayteam"]; ?></td>                <td><?php echo $res["competition"]; ?></td>                <td><?php echo $res["date"]; ?></td>                <td><?php echo $res["time"]; ?></td>               <td><?php echo $res["channelid"]; ?></td>               <td><?php echo $res["name"]; ?></td>             </tr> 

my issue match details displayed twice there 2 channels listed showing same match (see image)

incorrectoutput

my desired output have details each match shown once, , names of multiple channels showing matches displayed in channel name column (no multiple rows)

i tried using group_concat, didn't have success, tried group_concat know not recommended have multiple values per field in mysql.

many can provide assistance or guidance.

adding group_by on home team, away team , competition along group_concat of channels should work!


Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -