500 Internal Server Error

SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'GROUP BY i.ID' at line 15 (42000)

#0 /var/www/html/CM/Database/CSql.php(304): PDO->query()
#1 /var/www/html/sites/haat/templates/tuotekone.php(140): CM\Database\CSql->getValues()
#2 /var/www/html/CM/Template/View.php(84): include('...')
#3 /var/www/html/CM/Template/View.php(92): CM\Template\View->render()
#4 /var/www/html/CM/Engine.php(358): CM\Template\View->fetch()
#5 [internal function]: CM\Engine->_render()
#6 /var/www/html/CM/Core/Dispatcher.php(145): call_user_func_array()
#7 /var/www/html/CM/Core/Dispatcher.php(128): CM\Core\Dispatcher->invokeMethod()
#8 /var/www/html/CM/Core/Dispatcher.php(52): CM\Core\Dispatcher->execute()
#9 /var/www/html/CM/Engine.php(119): CM\Core\Dispatcher->run()
#10 /var/www/html/CM/CM.php(66): CM\Engine->__call()
#11 /var/www/html/sites/haat/controllers/TuotekoneController.php(255): CM::__callStatic()
#12 /var/www/html/sites/haat/controllers/TuotekoneController.php(195): TuotekoneController->_renderTemplateItem()
#13 [internal function]: TuotekoneController->viewItemPath3Permalink()
#14 /var/www/html/CM/Core/Dispatcher.php(148): call_user_func_array()
#15 /var/www/html/CM/Core/Dispatcher.php(128): CM\Core\Dispatcher->invokeMethod()
#16 /var/www/html/CM/Net/Router.php(114): CM\Core\Dispatcher->execute()
#17 /var/www/html/CM/Engine.php(315): CM\Net\Router->route()
#18 [internal function]: CM\Engine->_start()
#19 /var/www/html/CM/Core/Dispatcher.php(145): call_user_func_array()
#20 /var/www/html/CM/Core/Dispatcher.php(128): CM\Core\Dispatcher->invokeMethod()
#21 /var/www/html/CM/Core/Dispatcher.php(52): CM\Core\Dispatcher->execute()
#22 /var/www/html/CM/Engine.php(119): CM\Core\Dispatcher->run()
#23 /var/www/html/CM/CM.php(66): CM\Engine->__call()
#24 /var/www/html/sites/haat/index.php(6): CM::__callStatic()
#25 {main}