Syntax error or access violation: 1140 Mixing of GROUP columns (MIN(),MAX(),COUNT(),...)

Created on 29 January 2018, almost 7 years ago
Updated 15 September 2024, 4 months ago

This is my views configuration

And output is

I can see the output when logged in. To see the output as anonymous user I set in permission page as " View user information : Anonymous " and got the below error.

The website encountered an unexpected error. Please try again later.</br></br><em class="placeholder">Drupal\Core\Database\DatabaseExceptionWrapper</em>: Exception in No of users[no_of_users]: SQLSTATE[42000]: Syntax error or access violation: 1140 Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause: SELECT users_field_data.uid AS uid, COUNT(user__roles.roles_target_id) AS user__roles_roles_target_id
FROM 
{users_field_data} users_field_data
LEFT JOIN {user__roles} user__roles ON users_field_data.uid = user__roles.entity_id; Array
(
)
 in <em class="placeholder">Drupal\views\Plugin\views\query\Sql-&gt;execute()</em> (line <em class="placeholder">1496</em> of <em class="placeholder">core/modules/views/src/Plugin/views/query/Sql.php</em>). <pre class="backtrace">Drupal\views\ViewExecutable-&gt;execute(NULL) (Line: 1451)
Drupal\views\ViewExecutable-&gt;render() (Line: 117)
Drupal\views\Plugin\views\display\Block-&gt;execute() (Line: 1627)
Drupal\views\ViewExecutable-&gt;executeDisplay(&#039;block_1&#039;, Array) (Line: 77)
Drupal\views\Element\View::preRenderViewElement(Array) (Line: 59)
Drupal\views\Plugin\Block\ViewsBlock-&gt;build() (Line: 203)
Drupal\block\BlockViewBuilder::preRender(Array)
call_user_func(&#039;Drupal\block\BlockViewBuilder::preRender&#039;, Array) (Line: 378)
Drupal\Core\Render\Renderer-&gt;doRender(Array) (Line: 450)
Drupal\Core\Render\Renderer-&gt;doRender(Array, ) (Line: 195)
Drupal\Core\Render\Renderer-&gt;render(Array) (Line: 490)
Drupal\Core\Template\TwigExtension-&gt;escapeFilter(Object, Array, &#039;html&#039;, NULL, 1) (Line: 340)
__TwigTemplate_4a80d2e940672d7ecd680f8b0a6d32e7ae7f79a8c4ad5a379b2fdd15200feed9-&gt;block_footer(Array, Array) (Line: 215)
Twig_Template-&gt;displayBlock(&#039;footer&#039;, Array, Array) (Line: 90)
__TwigTemplate_4a80d2e940672d7ecd680f8b0a6d32e7ae7f79a8c4ad5a379b2fdd15200feed9-&gt;doDisplay(Array, Array) (Line: 432)
Twig_Template-&gt;displayWithErrorHandling(Array, Array) (Line: 403)
Twig_Template-&gt;display(Array) (Line: 411)
Twig_Template-&gt;render(Array) (Line: 64)
twig_render_template(&#039;themes/qgm/templates/system/page.html.twig&#039;, Array) (Line: 384)
Drupal\Core\Theme\ThemeManager-&gt;render(&#039;page&#039;, Array) (Line: 437)
Drupal\Core\Render\Renderer-&gt;doRender(Array, ) (Line: 195)
Drupal\Core\Render\Renderer-&gt;render(Array) (Line: 490)
Drupal\Core\Template\TwigExtension-&gt;escapeFilter(Object, Array, &#039;html&#039;, NULL, 1) (Line: 90)
__TwigTemplate_e1a9dbb34caa1c133cb544a7069db1587b57988d97401f143244d11a5c570367-&gt;doDisplay(Array, Array) (Line: 432)
Twig_Template-&gt;displayWithErrorHandling(Array, Array) (Line: 403)
Twig_Template-&gt;display(Array) (Line: 411)
Twig_Template-&gt;render(Array) (Line: 64)
twig_render_template(&#039;themes/bootstrap/templates/system/html.html.twig&#039;, Array) (Line: 384)
Drupal\Core\Theme\ThemeManager-&gt;render(&#039;html&#039;, Array) (Line: 437)
Drupal\Core\Render\Renderer-&gt;doRender(Array, ) (Line: 195)
Drupal\Core\Render\Renderer-&gt;render(Array) (Line: 147)
Drupal\Core\Render\MainContent\HtmlRenderer-&gt;Drupal\Core\Render\MainContent\{closure}() (Line: 582)
Drupal\Core\Render\Renderer-&gt;executeInRenderContext(Object, Object) (Line: 148)
Drupal\Core\Render\MainContent\HtmlRenderer-&gt;renderResponse(Array, Object, Object) (Line: 90)
Drupal\Core\EventSubscriber\MainContentViewSubscriber-&gt;onViewRenderArray(Object, &#039;kernel.view&#039;, Object) (Line: 108)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher-&gt;dispatch(&#039;kernel.view&#039;, Object) (Line: 158)
Symfony\Component\HttpKernel\HttpKernel-&gt;handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel-&gt;handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session-&gt;handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle-&gt;handle(Object, 1, 1) (Line: 99)
Drupal\page_cache\StackMiddleware\PageCache-&gt;pass(Object, 1, 1) (Line: 78)
Drupal\page_cache\StackMiddleware\PageCache-&gt;handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware-&gt;handle(Object, 1, 1) (Line: 50)
Drupal\Core\StackMiddleware\NegotiationMiddleware-&gt;handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel-&gt;handle(Object, 1, 1) (Line: 657)
Drupal\Core\DrupalKernel-&gt;handle(Object) (Line: 19)
</pre>
🐛 Bug report
Status

Closed: outdated

Version

11.0 🔥

Component
Views 

Last updated 9 minutes ago

Created by

🇮🇳India dbjpanda

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇳🇿New Zealand quietone

    I tested on Drupal 11.x standard install using the steps to reproduce in #4. I was not able to reproduce the problem.

    Therefore, closing. If you are experiencing this problem on a supported version of Drupal reopen the issue, by setting the status to 'Active', and provide complete steps to reproduce the issue (starting from "Install Drupal core").

    Thanks!

Production build 0.71.5 2024