Drupal is a registered trademark of Dries Buytaert
Release: Paragraphs 8.x-1.23 Minor update available for module paragraphs (8.x-1.23). Release: AI (Artificial Intelligence) 1.4.6 Minor update available for module ai (1.4.6). Release: AI (Artificial Intelligence) 1.3.11 Minor update available for module ai (1.3.11). Release: Search and Replace Scanner 2.0.0 Major update available for module scanner (2.0.0). Release: Chosen 5.0.7 Minor update available for module chosen (5.0.7). Release: Instagram Feed Block 1.0.2 Minor update available for module instagram_feed_block (1.0.2). Release: Mercury Editor Page Templates 1.0.10 Minor update available for module mercury_editor_page_templates (1.0.10). Release: Content Packages 1.1.0 Minor update available for module content_packages (1.1.0). Module Revived: Entity Browser 8.x-2.16 Module entity_browser updated after 11 months of inactivity (8.x-2.16). Usage Milestone: Media entity Twitter Module media_entity_twitter crossed 10,000 active installs.

Overview

The Field Comparison for Views module allows you to perform comparisons between fields within a Views query in Drupal 8 and beyond. This feature, originally part of the popular Views module in Drupal 7, enables you to filter or sort content based on field-to-field comparisons or field-to-static-value comparisons.

With this module, you can build advanced queries that compare values from different content fields, such as dates, numbers, text fields, and more. This gives you enhanced flexibility in controlling the display of your content and ensures that Views can meet more specific use cases for your Drupal site.

Key Features

Field-to-Field Comparisons: Compare fields directly within Views, such as checking if one date field is earlier or later than another.
Field-to-Static Value Comparisons: Compare a field against a fixed value (e.g., check if the price field is greater than $50).
Easy Integration: Seamlessly integrates into the Views interface, allowing for intuitive configuration directly from the Views UI.
Flexible Filtering and Sorting: Add field comparison conditions to your Views filters or sort criteria, enabling powerful content displays.
Drupal 8+ Compatibility: Fully ported and maintained for Drupal 8 and later versions.

Usage

Creating a View with Field Comparison:
When editing a view, add a new filter or sort criterion.
Select the field you want to compare.
Choose the comparison operator, such as =, >, <, !=, etc.
Optionally, select another field to compare it to or input a static value.
Examples:
Date Comparison: Display content where start_date is greater than the end_date.
Number Comparison: Show all products where the price field is less than 100.
For more detailed examples, check the module documentation or issue queue.

Develop Views field comparison using DDEV ⚙

If you haven't already, install DDEV.

git clone [email protected]:project/views_field_comparison.git
cd views_field_comparison
ddev config --project-type=drupal --docroot=web --php-version=8.4 --corepack-enable --project-name=views-field-comparison
ddev add-on get ddev/ddev-drupal-contrib
ddev add-on get s-ayers/ddev-drupal-contrib-mkdocs
ddev start
ddev poser
ddev symlink-project
ddev drush site:install -y
ddev drush pm:install views_field_comparison -y
ddev drush config:export -y
ddev drush user:login

Consider sponsoring DDEV development.

Activity

Tracked releases
1
Tracked since
Aug 2026
Latest release
2 hours ago
Releases (12 mo)
1 ▲ from 0
Maintenance
Active

Releases

Version Type Release date
1.0.1 Stable Aug 5, 2026