-1

Using Mysql on Joomla 2.5. Here is my code. Works great except doesn't show results where no users (u) attached to team (t).

$query = "SELECT DISTINCT(t.id) as id,t.*, GROUP_CONCAT(DISTINCT ' ',MID(u.first_name,1,1) ,'.',u.last_name) as name 
    FROM #__bl_teams as t 

    LEFT JOIN (#__bl_teamcord as tc, #__users as u) ON(FIND_IN_SET(t.id,tc.teams)AND tc.u_id = u.id)

    WHERE 
    t.id != 0
    AND t.id != 1 
    AND ".$season_id." = t.s_id

    GROUP BY t.id

    ORDER BY t.t_name";

$db->setQuery($query);
$rows = $db->loadObjectList();
foreach($rows as $row){
   echo $row->id.' - '.$row->name.'<br />';
}
Halvor Holsten Strand
  • 19,829
  • 17
  • 83
  • 99
user1071915
  • 99
  • 3
  • 12

1 Answers1

0

It works fine now. Not sure why it didn't work earlier.

user1071915
  • 99
  • 3
  • 12