getQueryParams($apiKey, $dateRange); $queryConditions = $this->getQueryConditions($dateRange); $queryConditions[] = 'event_ip.shared > 1'; $queryConditions = join(' AND ', $queryConditions); $query = ( "SELECT MAX(event_ip.ip) AS ip, MAX(event_ip.id) AS ipid, MAX(event_ip.shared) AS value, MAX(event_isp.name) AS isp_name, MAX(countries.value) AS full_country, MAX(countries.id) AS country_id, MAX(countries.iso) AS country_iso FROM event INNER JOIN event_ip ON (event.ip = event_ip.id) INNER JOIN countries ON (event_ip.country = countries.id) INNER JOIN event_isp ON (event_ip.isp = event_isp.id) WHERE {$queryConditions} GROUP BY event_ip.ip ORDER BY value DESC LIMIT 10 OFFSET 0" ); return $this->execQuery($query, $params); } }