Fixed an AR bug when joining with a table alias and table prefix (#4400).
diff --git a/system/database/DB_active_rec.php b/system/database/DB_active_rec.php
index d585806..6f50c11 100644
--- a/system/database/DB_active_rec.php
+++ b/system/database/DB_active_rec.php
@@ -1476,7 +1476,7 @@
$sql = ( ! $this->ar_distinct) ? 'SELECT ' : 'SELECT DISTINCT ';
- $sql .= (count($this->ar_select) == 0) ? '*' : implode(', ', $this->ar_select);
+ $sql .= (count($this->ar_select) == 0) ? '*' : implode(', ', $this->_filter_table_aliases($this->ar_select));
if ($select_override !== FALSE)
{