I have the following sql query which when run from the console perfectly generates the result I want
SELECT *
FROM tbl_fixtures f
LEFT JOIN tbl_countries h
ON f.home_team = h.country_id
LEFT JOIN tbl_countries a
ON f.away_team = a.country_id;
But when I run it from Codeigniter with the normal $this->db->query($sql)->result_array()
I get only the last column of the team i.e. I get no h.country_id
but only country id for the away team (which i am assuming it is replacing the first team). Could this be because of the f.
a.
and h.
concats?. Can you please help on this query.
This is the var_dump of one result, because there is a lot of data but they are the same:
[0]=>
array(8) {
["matchid"]=> string(1) "1"
["home_team"]=> string(1) "1"
["away_team"]=> string(1) "2"
["date"]=> string(19) "2016-06-10 21:00:00"
["country_id"]=> string(1) "2"
["country_code"]=> string(2) "RO"
["country_name"]=> string(7) "Romania"
["group"]=> string(1) "A"