Drupal is a registered trademark of Dries Buytaert
Protected Pages 3.0.0 Major update available for module protected_pages (3.0.0). Commerce Core 3.3.8 Minor update available for module commerce (3.3.8). Layout Builder Reorder 2.0.1 Minor update available for module layout_builder_reorder (2.0.1). Ban 1.1.0 Minor update available for module ban (1.1.0). Field Formatter Range 2.0.0 Major update available for module field_formatter_range (2.0.0). Field Formatter Range 8.x-1.8 Minor update available for module field_formatter_range (8.x-1.8). UI Patterns (SDC in Drupal UI) 2.0.18 Minor update available for module ui_patterns (2.0.18). Varbase FAQs 9.2.1 Minor update available for module varbase_faqs (9.2.1). Search API Solr 4.3.11 Module search_api_solr updated after 14 months of inactivity (4.3.11). Provus Mega Menu Module provus_mega_menu crossed 1,000 active installs.

This module extends Drupal Views to aggregate and concatenate string fields at the database level. It allows you to combine multiple text values into a single string, with options to customize separators, ordering, and distinct values, all handled natively by your database.

Views String Aggregation is a new module that extends Drupal Views with database-level string aggregation and concatenation capabilities.

If you would like to combine values into concatenated string results, using more than the default core numeric aggregation options, then Views String Aggregation provides an SQL-native solution.

Key features

SQL optimized

String aggregation and concatenation happens at the SQL level using native database functions, such as GROUP_CONCAT and STRING_AGG.

Flexible configuration

  • Choose a separator (e.g comma, pipe, space etc..)
  • Order concatenated values by selected field
  • Sort concatenated values ASC or DESC
  • Show distinct values only
  • Set group_concat_max_len (MySQL/MariaDB)
  • Automatic Views integration

Supports multiple database types

  • MySQL/MariaDB: Uses GROUP_CONCAT with max length, custom separator, ordering and distinct support
  • PostgreSQL: Uses STRING_AGG with custom separator, ordering and distinct support
  • SQLite: Uses GROUP_CONCAT with custom separator, ordering and distinct support
  • Database type is detected and handled automatically

Easy to use

No complex configuration required. Simply enable aggregation in your View and set a field to use "String aggregation" type.

Views String Aggregation field settings

Fig 1: New field aggregation settings are provided for string aggregation.

Example

Uses

  • Content aggregation: Display all values for a field grouped by other field value
  • Commerce: Display all order item titles grouped by order
  • REST API endpoints: Create Views REST API response data including aggregated and concatenated field data
  • Data exports: Create Views CSV exports including aggregated and concatenated field data
  • etc…

Results

Before: Multiple rows per content item

Title Value Getting Started with Drupal drupal Getting Started with Drupal tutorial Getting Started with Drupal beginner

After: Aggregated and concatenated results as a comma separated string

Title Values Getting Started with Drupal drupal, tutorial, beginner

Installation & Usage

  1. Install the module using Composer (recommended) or by downloading manually
  2. Enable the module: e.g:drush en views_string_aggregation
  3. In your View, enable Use aggregation in Advanced settings
  4. Set desired fields to String aggregation or String aggregation DISTINCT aggregation type
  5. Optionally configure grouping, e.g customize separator, max string length or order by field, under Advanced > Other > Query Settings

That's it! Your View will now display nicely aggregated string data.

Usage note:

Aggregation happens at the SQL level. Be aware of how the fields you configure to use the default “Group by” type aggregation affect the result. For example grouping by a node id field will show records grouped by node id on separate rows. However, you could for example use string aggregation to show a set of node ids grouped by type.

Similar modules

Views Aggregator Plus

Differences

  • Views Aggregator Plus provides a custom Views table display with a variety of aggregation features, using PHP at the display level.
  • Views String Aggregation is different because it works for any aggregation-enabled Views display and provides string aggregation using native SQL functions at the query level.

Acknowledgements

This module acknowledges with thanks the initial work contributed in https://www.drupal.org/project/drupal/issues/2902481 namely by

Requirements

  • Drupal 9.x, 10.x or 11.x
  • Views module (included in Drupal core)
  • MySQL 5.7+, MariaDB 10.2+, SQLite 3+ or PostgreSQL 9.1+

Note: A legacy Drupal 9 version is also available.

Activity

Total releases
15
First release
Sep 2025
Latest release
9 months ago
Releases (12 mo)
15 ▲ from 0
Maintenance
Slowing

Release Timeline

Releases

Version Type Release date
9.0.0 Stable Sep 21, 2025
9.0.x-dev Dev Sep 21, 2025
1.0.2 Stable Sep 19, 2025
1.0.1 Stable Sep 17, 2025
1.0.0-rc10 Pre-release Sep 9, 2025
1.0.0-rc9 Pre-release Sep 9, 2025
1.0.0-rc8 Pre-release Sep 8, 2025
1.0.0-rc7 Pre-release Sep 7, 2025
1.0.0-rc6 Pre-release Sep 7, 2025
1.0.0-rc5 Pre-release Sep 7, 2025
1.0.0-rc4 Pre-release Sep 7, 2025
1.0.0-rc3 Pre-release Sep 7, 2025
1.0.0-rc2 Pre-release Sep 7, 2025
1.0.0-rc1 Pre-release Sep 7, 2025
1.0.x-dev Dev Sep 7, 2025