Closed (fixed)
Project:
Views Group By
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Reporter:
Created:
10 Jun 2009 at 10:37 UTC
Updated:
23 Jul 2010 at 22:40 UTC
Hi. I have a list of nodes that I want to group by taxonomy term of a given vocab. Unfortunately this is not possible as it results in a sql error :( Any advice?
Comments
Comment #1
irakli commentedPlease give more detailed information about what you are trying to do. Settings you are using, error you are getting etc.
It is not only possible, but how to do it is the prime example of the module's usage:
http://drupal.org/node/389230
Comment #2
rapsli commented* user warning: Unknown column 'unknown' in 'group statement' query: SELECT COUNT(*) FROM (SELECT COUNT(node.nid) AS nid, term_data.name AS term_data_name, term_data.vid AS term_data_vid, term_data.tid AS term_data_tid, node.sticky AS node_sticky, node.created AS node_created FROM vw_node node LEFT JOIN vw_term_node term_node ON node.vid = term_node.vid LEFT JOIN vw_term_data term_data ON term_node.tid = term_data.tid WHERE (node.promote <> 0) AND (node.status <> 0) AND (node.created < 1244636231+864000) GROUP BY unknown, node_sticky, node_created, term_data_name, term_data_vid, term_data_tid ORDER BY node_created ASC, node_sticky DESC, node_created DESC ) count_alias in /opt/lampp/htdocs/sites/all/modules/views/includes/view.inc on line 705.
* user warning: Unknown column 'unknown' in 'group statement' query: SELECT COUNT(node.nid) AS nid, term_data.name AS term_data_name, term_data.vid AS term_data_vid, term_data.tid AS term_data_tid, node.sticky AS node_sticky, node.created AS node_created FROM vw_node node LEFT JOIN vw_term_node term_node ON node.vid = term_node.vid LEFT JOIN vw_term_data term_data ON term_node.tid = term_data.tid WHERE (node.promote <> 0) AND (node.status <> 0) AND (node.created < 1244636231+864000) GROUP BY unknown, node_sticky, node_created, term_data_name, term_data_vid, term_data_tid ORDER BY node_created ASC, node_sticky DESC, node_created DESC LIMIT 0, 20 in /opt/lampp/htdocs/sites/all/modules/views/includes/view.inc on line 731.
$view = new view;
$view->name = 'frontpage';
$view->description = 'Emulates the default Drupal front page; you may set the default home page path to this view to make it your front page.';
$view->tag = 'default';
$view->view_php = '';
$view->base_table = 'node';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->override_option('fields', array(
'field_image_image_fid' => array(
'label' => '',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'link_to_node' => 0,
'label_type' => 'none',
'format' => 'teaser_small_linked',
'multiple' => array(
'group' => 1,
'multiple_number' => '',
'multiple_from' => '',
'multiple_reversed' => 0,
),
'exclude' => 0,
'id' => 'field_image_image_fid',
'table' => 'node_data_field_image_image',
'field' => 'field_image_image_fid',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
'title' => array(
'label' => '',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'link_to_node' => 1,
'exclude' => 0,
'id' => 'title',
'table' => 'node',
'field' => 'title',
'relationship' => 'none',
'override' => array(
'button' => 'Override',
),
),
'created' => array(
'label' => '',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'date_format' => 'small',
'custom_date_format' => '',
'exclude' => 0,
'id' => 'created',
'table' => 'node',
'field' => 'created',
'relationship' => 'none',
'override' => array(
'button' => 'Override',
),
),
'nid' => array(
'label' => '',
'alter' => array(
'alter_text' => 1,
'text' => 'Add to cart',
'make_link' => 1,
'path' => 'files_collector/add/[nid]',
'alt' => '',
'prefix' => '',
'suffix' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'link_to_node' => 0,
'exclude' => 0,
'id' => 'nid',
'table' => 'node',
'field' => 'nid',
'override' => array(
'button' => 'Übersteuern',
),
'relationship' => 'none',
),
'views_sql_groupedfields' => array(
'label' => 'Group By Fields',
'alter' => array(
'alter_text' => FALSE,
'text' => '',
'make_link' => FALSE,
'path' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'trim' => FALSE,
'max_length' => '',
'word_boundary' => TRUE,
'ellipsis' => TRUE,
'strip_tags' => FALSE,
'html' => FALSE,
),
'exclude' => '1',
'id' => 'views_sql_groupedfields',
'table' => 'views_groupby',
'field' => 'views_sql_groupedfields',
'relationship' => 'none',
'views_groupby_fields_to_group' => array(
'name' => 'name',
),
'views_groupby_sql_function' => 'count',
'views_groupby_fields_to_aggregate' => array(
'nid' => 'nid',
),
'views_groupby_field_sortby' => 'created',
'views_groupby_sortby_direction' => 'asc',
),
'name' => array(
'label' => 'Term',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'link_to_taxonomy' => 0,
'exclude' => 0,
'id' => 'name',
'table' => 'term_data',
'field' => 'name',
'relationship' => 'none',
),
));
$handler->override_option('sorts', array(
'sticky' => array(
'id' => 'sticky',
'table' => 'node',
'field' => 'sticky',
'order' => 'DESC',
),
'created' => array(
'id' => 'created',
'table' => 'node',
'field' => 'created',
'order' => 'DESC',
'relationship' => 'none',
'granularity' => 'second',
),
));
$handler->override_option('filters', array(
'promote' => array(
'id' => 'promote',
'table' => 'node',
'field' => 'promote',
'operator' => '=',
'value' => '1',
'group' => 0,
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
),
'status' => array(
'id' => 'status',
'table' => 'node',
'field' => 'status',
'operator' => '=',
'value' => '1',
'group' => 0,
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
),
'created' => array(
'operator' => '<',
'value' => array(
'type' => 'offset',
'value' => '+10 days',
'min' => '',
'max' => '',
),
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'created',
'table' => 'node',
'field' => 'created',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
));
$handler->override_option('access', array(
'type' => 'role',
'role' => array(
'3' => 3,
'4' => 4,
'5' => 5,
'6' => 6,
),
));
$handler->override_option('title', 'News');
$handler->override_option('header_format', '1');
$handler->override_option('footer_format', '1');
$handler->override_option('empty_format', '1');
$handler->override_option('items_per_page', 20);
$handler->override_option('use_pager', '1');
$handler->override_option('distinct', 0);
$handler->override_option('style_plugin', 'grid');
$handler->override_option('style_options', array(
'grouping' => '',
'columns' => '5',
'alignment' => 'horizontal',
));
$handler->override_option('row_options', array(
'inline' => array(),
'separator' => '',
));
$handler = $view->new_display('page', 'Page', 'page');
$handler->override_option('header', 'Displaying the all nodes that have the flag "promoted to frontpage" set.');
$handler->override_option('header_empty', 0);
$handler->override_option('use_ajax', TRUE);
$handler->override_option('path', 'frontpage');
$handler->override_option('menu', array(
'type' => 'none',
'title' => '',
'description' => '',
'weight' => 0,
'name' => 'navigation',
));
$handler->override_option('tab_options', array(
'type' => 'none',
'title' => '',
'description' => '',
'weight' => 0,
));
$handler = $view->new_display('feed', 'Feed', 'feed');
$handler->override_option('title', 'Front page feed');
$handler->override_option('style_plugin', 'rss');
$handler->override_option('style_options', array(
'mission_description' => 1,
'description' => '',
));
$handler->override_option('row_plugin', 'node_rss');
$handler->override_option('row_options', array(
'item_length' => 'default',
));
$handler->override_option('path', 'rss.xml');
$handler->override_option('menu', array(
'type' => 'none',
'title' => '',
'description' => '',
'weight' => 0,
'name' => 'navigation',
));
$handler->override_option('tab_options', array(
'type' => 'none',
'title' => '',
'description' => '',
'weight' => 0,
));
$handler->override_option('displays', array(
'default' => 'default',
'page' => 'page',
));
$handler->override_option('sitename_title', '1');
$handler = $view->new_display('block', 'Block', 'block_1');
$handler->override_option('fields', array(
'title' => array(
'label' => '',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'link_to_node' => 1,
'exclude' => 0,
'id' => 'title',
'table' => 'node',
'field' => 'title',
'relationship' => 'none',
'override' => array(
'button' => 'Use default',
),
),
'created' => array(
'label' => '',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'date_format' => 'raw time ago',
'custom_date_format' => '',
'exclude' => 0,
'id' => 'created',
'table' => 'node',
'field' => 'created',
'relationship' => 'none',
'override' => array(
'button' => 'Use default',
),
),
));
$handler->override_option('filters', array(
'status' => array(
'id' => 'status',
'table' => 'node',
'field' => 'status',
'operator' => '=',
'value' => '1',
'group' => 0,
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
),
'created' => array(
'operator' => '<',
'value' => array(
'type' => 'offset',
'value' => '+10 days',
'min' => '',
'max' => '',
),
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'created',
'table' => 'node',
'field' => 'created',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
));
$handler->override_option('title', 'New Items');
$handler->override_option('items_per_page', 5);
$handler->override_option('use_pager', '0');
$handler->override_option('style_plugin', 'default');
$handler->override_option('style_options', array());
$handler->override_option('row_options', array());
$handler->override_option('block_description', '');
$handler->override_option('block_caching', -1);
$handler = $view->new_display('page', 'Page', 'page_1');
$handler->override_option('style_plugin', 'bulk');
$handler->override_option('style_options', array(
'grouping' => '',
'override' => 1,
'sticky' => 0,
'order' => 'asc',
'columns' => array(
'field_image_iamge_fid' => 'field_image_iamge_fid',
'title' => 'title',
'created' => 'created',
'type' => 'type',
),
'info' => array(
'field_image_iamge_fid' => array(
'separator' => '',
),
'title' => array(
'sortable' => 1,
'separator' => '',
),
'created' => array(
'sortable' => 1,
'separator' => '',
),
'type' => array(
'sortable' => 1,
'separator' => '',
),
),
'default' => '-1',
'execution_type' => '1',
'display_type' => '0',
'skip_confirmation' => 0,
'display_result' => 1,
'merge_single_action' => 1,
'selected_operations' => array(
'3ea33dae73a849deedd536991455be98' => '3ea33dae73a849deedd536991455be98',
'c6d3850086dc3c1bca4bf0625ce78c56' => 'c6d3850086dc3c1bca4bf0625ce78c56',
'15faf15d7f591f8ef8e80238dd7c8b8c' => '15faf15d7f591f8ef8e80238dd7c8b8c',
'548749a939aa6334157edff3d8f69351' => '548749a939aa6334157edff3d8f69351',
'6a99179e9c90e9edfb34d075fa234d78' => 0,
'7a3d2d5b1bb6ecb0cb811c4130452d7d' => 0,
'132fddcb3f367a243bee632db31985c1' => 0,
'334d20af1ae7ac4b770b7ec3210b2638' => 0,
'799e8527bbd3d99e4c8c25a8a674d264' => 0,
'fce859fcce0e81943c3e31c20ccd68ff' => 0,
'591b41a4f10db44fb0b09b1e25152cef' => 0,
'4df6cb87c9bbb08ebec8c757e9a0fcc7' => 0,
'f033f40d92f0308ed6b2e3befb3a4c2a' => 0,
'0341fcc505281031474b68c72e03a997' => 0,
'10edeb21cdd1fd049751311229c5e736' => 0,
'3864faba61f46e2b68393b7fc88fa830' => 0,
'52aec7fee2070ce530da1304653ae1ec' => 0,
'94a098afb1689f950d72ed4c44f8655d' => 0,
'1dcecde02b48fdfde9628fea88920225' => 0,
'daa75f478e3093ab107e657da6620a91' => 0,
'6f7871c7725f0c91c07594602f07aa72' => 0,
'c6db6d4ee28924020b504a5feb2bff9f' => 0,
'5471472ae2eedc59c992b6859d26033b' => 0,
),
));
$handler->override_option('row_plugin', 'node');
$handler->override_option('row_options', array(
'teaser' => 1,
'links' => 1,
));
$handler->override_option('path', 'admin_content');
$handler->override_option('menu', array(
'type' => 'none',
'title' => '',
'description' => '',
'weight' => 0,
'name' => 'navigation',
));
$handler->override_option('tab_options', array(
'type' => 'none',
'title' => '',
'description' => '',
'weight' => 0,
));
Comment #3
rsevero commentedI'm not sure how to test with the above data.
Would need a detailed explanation on how to reproduce this issue.
Please reopen with extra info if necessary.