function prepareAndRunQuery($select, $from, $where, $groupby, $perPage, $pageNo)
 {
     if ($this->GetSourceType($from->sid) == "data file") {
         $externalDBCredentials = $this->GetExternalDBCredentialsBySid($from->sid);
         $tableName = $from->tableName;
         if (isset($from->alias)) {
             $tableName .= ' as ' . $from->alias;
         }
         return ExternalDBs::PrepareAndRunQuery($select, $tableName, $where, $groupby, $perPage, $pageNo, $externalDBCredentials);
     } else {
         return $this->prepareAndRunQueryFromFile($select, $from, $where, $groupby, $perPage, $pageNo);
     }
 }