public function findVisitsHours(Range $interval, bool $useTime = false): ?Result
	{
		$date = $useTime ? '%dt' : 'DATE(%dt)';

		$subQuery = 'SELECT '
			. 'DATE_FORMAT([inserted], "%%Y-%%m-%%d %%H:00:00") datefield, '
			. 'COUNT([uid]) visits '
			. 'FROM %table '
			. 'WHERE ' . ($useTime ? '[inserted]' : 'DATE([inserted])') . ' BETWEEN ' . $date . ' AND ' . $date . ' '
			. 'GROUP BY [uid], ROUND(UNIX_TIMESTAMP([inserted]) / %i)';
		return $this->connection->query('SELECT [datefield], COUNT([visits]) visits FROM (' . $subQuery . ') sub GROUP BY HOUR([datefield]), DAY([datefield])', $this->getTableName(), $interval->from, $interval->to, $this->minTimeBetweenVisits * 60);
	}
public function findVisitsHours(Range $interval, bool $useTime = false): ?Result
	{
		$date = $useTime ? '%dt' : 'DATE(%dt)';

		$subQuery = 'SELECT '
			. 'DATE_FORMAT([inserted], "%%Y-%%m-%%d %%H:00:00") datefield, '
			. 'COUNT([uid]) visits '
			. 'FROM %table '
			. 'WHERE ' . ($useTime ? '[inserted]' : 'DATE([inserted])') . ' BETWEEN ' . $date . ' AND ' . $date . ' '
			. 'GROUP BY [uid], ROUND(UNIX_TIMESTAMP([inserted]) / %i)';
		return $this->connection->query('SELECT [datefield], COUNT([visits]) visits FROM (' . $subQuery . ') sub GROUP BY HOUR([datefield]), DAY([datefield])', $this->getTableName(), $interval->from, $interval->to, $this->minTimeBetweenVisits * 60);
	}
public function findVisitsHours ( Range $ interval , bool $ useTime = false ) : ? Result { $ date = $ useTime ? '%dt' : 'DATE(%dt)' ; $ subQuery = 'SELECT ' . 'DATE_FORMAT([inserted], "%%Y-%%m-%%d %%H:00:00") datefield, ' . 'COUNT([uid]) visits ' . 'FROM %table ' . 'WHERE ' . ( $ useTime ? '[inserted]' : 'DATE([inserted])' ) . ' BETWEEN ' . $ date . ' AND ' . $ date . ' ' . 'GROUP BY [uid], ROUND(UNIX_TIMESTAMP([inserted]) / %i)' ; return $ this -> connection -> query ( 'SELECT [datefield], COUNT([visits]) visits FROM (' . $ subQuery . ') sub GROUP BY HOUR([datefield]), DAY([datefield])' , $ this -> getTableName ( ) , $ interval -> from , $ interval -> to , $ this -> minTimeBetweenVisits * 60 ) ; }
Vrati navstevy po hodinach
@param Range $interval
@param bool $useTime ma se pouzit cas v intervalu
@return Result|null
@throws QueryException
Vrati navstevy po hodinach