diff --git a/system/database/DB_active_rec.php b/system/database/DB_active_rec.php
index 90f58ae..d27d3dc 100644
--- a/system/database/DB_active_rec.php
+++ b/system/database/DB_active_rec.php
@@ -134,7 +134,17 @@
 				$type .= ' ';
 			}
 		}
-	
+		
+		// If a DB prefix is used we might need to add it to the column names
+		if ($this->dbprefix)
+		{
+			// First we remove any existing prefixes in the condition to avoid duplicates
+			$cond = preg_replace('|('.$this->dbprefix.')([\w\.]+)([\W\s]+)|', "$2$3", $cond);
+			
+			// Next we add the prefixes to the condition
+			$cond = preg_replace('|([\w\.]+)([\W\s]+)(.+)|', $this->dbprefix . "$1$2" . $this->dbprefix . "$3", $cond);
+		}
+		
 		$this->ar_join[] = $type.'JOIN '.$this->dbprefix.$table.' ON '.$cond;
 		return $this;
 	}