Abstracted FROM table listing in Active Record for databases that do not support parenthetic grouping of tables to explicitly define operator precedence
diff --git a/system/database/DB_active_rec.php b/system/database/DB_active_rec.php
index 1ad4f3d..37bf9ed 100644
--- a/system/database/DB_active_rec.php
+++ b/system/database/DB_active_rec.php
@@ -1343,7 +1343,7 @@
 		if (count($this->ar_from) > 0)

 		{

 			$sql .= "\nFROM ";

-			$sql .= '(' . implode(', ', $this->ar_from) . ')';

+			$sql .= $this->_from_tables($this->ar_from);

 		}

 

 		if (count($this->ar_join) > 0)

diff --git a/system/database/drivers/mssql/mssql_driver.php b/system/database/drivers/mssql/mssql_driver.php
index e0c4db7..ad747d4 100644
--- a/system/database/drivers/mssql/mssql_driver.php
+++ b/system/database/drivers/mssql/mssql_driver.php
@@ -439,6 +439,28 @@
 	// --------------------------------------------------------------------

 

 	/**

+	 * From Tables

+	 *

+	 * This function implicitly groups FROM tables so there is no confusion

+	 * about operator precedence in harmony with SQL standards

+	 *

+	 * @access	public

+	 * @param	type

+	 * @return	type

+	 */

+	function _from_tables($tables)

+	{

+		if (! is_array($tables))

+		{

+			$tables = array($tables);

+		}

+		

+		return implode(', ', $tables);

+	}

+

+	// --------------------------------------------------------------------

+	

+	/**

 	 * Insert statement

 	 *

 	 * Generates a platform-specific insert string from the supplied data

diff --git a/system/database/drivers/mysql/mysql_driver.php b/system/database/drivers/mysql/mysql_driver.php
index 6e53537..f002572 100644
--- a/system/database/drivers/mysql/mysql_driver.php
+++ b/system/database/drivers/mysql/mysql_driver.php
@@ -480,6 +480,28 @@
 	// --------------------------------------------------------------------

 

 	/**

+	 * From Tables

+	 *

+	 * This function implicitly groups FROM tables so there is no confusion

+	 * about operator precedence in harmony with SQL standards

+	 *

+	 * @access	public

+	 * @param	type

+	 * @return	type

+	 */

+	function _from_tables($tables)

+	{

+		if (! is_array($tables))

+		{

+			$tables = array($tables);

+		}

+		

+		return '('.implode(', ', $tables).')';

+	}

+

+	// --------------------------------------------------------------------

+	

+	/**

 	 * Insert statement

 	 *

 	 * Generates a platform-specific insert string from the supplied data

diff --git a/system/database/drivers/mysqli/mysqli_driver.php b/system/database/drivers/mysqli/mysqli_driver.php
index d645cc8..b2e97f9 100644
--- a/system/database/drivers/mysqli/mysqli_driver.php
+++ b/system/database/drivers/mysqli/mysqli_driver.php
@@ -474,6 +474,28 @@
 	// --------------------------------------------------------------------

 

 	/**

+	 * From Tables

+	 *

+	 * This function implicitly groups FROM tables so there is no confusion

+	 * about operator precedence in harmony with SQL standards

+	 *

+	 * @access	public

+	 * @param	type

+	 * @return	type

+	 */

+	function _from_tables($tables)

+	{

+		if (! is_array($tables))

+		{

+			$tables = array($tables);

+		}

+		

+		return '('.implode(', ', $tables).')';

+	}

+

+	// --------------------------------------------------------------------

+	

+	/**

 	 * Insert statement

 	 *

 	 * Generates a platform-specific insert string from the supplied data

diff --git a/system/database/drivers/oci8/oci8_driver.php b/system/database/drivers/oci8/oci8_driver.php
index 99f7d57..ddc0fba 100644
--- a/system/database/drivers/oci8/oci8_driver.php
+++ b/system/database/drivers/oci8/oci8_driver.php
@@ -585,6 +585,28 @@
 	// --------------------------------------------------------------------

 

 	/**

+	 * From Tables

+	 *

+	 * This function implicitly groups FROM tables so there is no confusion

+	 * about operator precedence in harmony with SQL standards

+	 *

+	 * @access	public

+	 * @param	type

+	 * @return	type

+	 */

+	function _from_tables($tables)

+	{

+		if (! is_array($tables))

+		{

+			$tables = array($tables);

+		}

+		

+		return '('.implode(', ', $tables).')';

+	}

+

+	// --------------------------------------------------------------------

+	

+	/**

 	 * Insert statement

 	 *

 	 * Generates a platform-specific insert string from the supplied data

diff --git a/system/database/drivers/odbc/odbc_driver.php b/system/database/drivers/odbc/odbc_driver.php
index 604dd77..03c0e6a 100644
--- a/system/database/drivers/odbc/odbc_driver.php
+++ b/system/database/drivers/odbc/odbc_driver.php
@@ -450,6 +450,28 @@
 	// --------------------------------------------------------------------

 

 	/**

+	 * From Tables

+	 *

+	 * This function implicitly groups FROM tables so there is no confusion

+	 * about operator precedence in harmony with SQL standards

+	 *

+	 * @access	public

+	 * @param	type

+	 * @return	type

+	 */

+	function _from_tables($tables)

+	{

+		if (! is_array($tables))

+		{

+			$tables = array($tables);

+		}

+		

+		return '('.implode(', ', $tables).')';

+	}

+

+	// --------------------------------------------------------------------

+	

+	/**

 	 * Insert statement

 	 *

 	 * Generates a platform-specific insert string from the supplied data

diff --git a/system/database/drivers/postgre/postgre_driver.php b/system/database/drivers/postgre/postgre_driver.php
index 96cf2df..20f9165 100644
--- a/system/database/drivers/postgre/postgre_driver.php
+++ b/system/database/drivers/postgre/postgre_driver.php
@@ -470,6 +470,28 @@
 	// --------------------------------------------------------------------

 

 	/**

+	 * From Tables

+	 *

+	 * This function implicitly groups FROM tables so there is no confusion

+	 * about operator precedence in harmony with SQL standards

+	 *

+	 * @access	public

+	 * @param	type

+	 * @return	type

+	 */

+	function _from_tables($tables)

+	{

+		if (! is_array($tables))

+		{

+			$tables = array($tables);

+		}

+		

+		return '('.implode(', ', $tables).')';

+	}

+

+	// --------------------------------------------------------------------

+	

+	/**

 	 * Insert statement

 	 *

 	 * Generates a platform-specific insert string from the supplied data

diff --git a/system/database/drivers/sqlite/sqlite_driver.php b/system/database/drivers/sqlite/sqlite_driver.php
index 9cc69bb..38febca 100644
--- a/system/database/drivers/sqlite/sqlite_driver.php
+++ b/system/database/drivers/sqlite/sqlite_driver.php
@@ -466,6 +466,28 @@
 	// --------------------------------------------------------------------

 

 	/**

+	 * From Tables

+	 *

+	 * This function implicitly groups FROM tables so there is no confusion

+	 * about operator precedence in harmony with SQL standards

+	 *

+	 * @access	public

+	 * @param	type

+	 * @return	type

+	 */

+	function _from_tables($tables)

+	{

+		if (! is_array($tables))

+		{

+			$tables = array($tables);

+		}

+		

+		return '('.implode(', ', $tables).')';

+	}

+

+	// --------------------------------------------------------------------

+	

+	/**

 	 * Insert statement

 	 *

 	 * Generates a platform-specific insert string from the supplied data