private function RemoveWherePrefix($sql)
	{
		$sql = trim($sql);
		
		// remove if the query is surrounded by parenths
		while (substr($sql,0,1) == "(" && substr($sql,0,-1) == ")")
		{
			$sql = trim( substr($sql,1,-1) );
		}
		
		while (strtolower( substr($sql, 0, 5) ) == "where")
		{
			$sql = trim(substr($sql,5));
		}
		
		return $sql;
	}