Drupal is a registered trademark of Dries Buytaert

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 “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. You could however use string aggregation to show a set of node ids grouped by type, for example.

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
5 months ago
Release cadence
1 day
Stability
20% stable

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