---
title: Compare Fields across Data Extensions
slug: segment/compare-fields-across-data-extensions
docTags: 
createdAt: 2026-01-19T00:23:06.799Z
---

Comparing fields across Data Extensions is supported i&#x6E;**&#x20;Filters**,**&#x20;Custom Values**, and sub-queries (**In Results/Not In Results** filters).

## Use cases

- Selecting contacts with an email address from a domain different from the company’s website domain
- Selecting contacts with the phone number equal to the mobile phone number
- Referring to a field from the main query when using sub queries.

## Compare fields

To compare the value of a field with a field of the same or another Data Extension, click the **Calendar** button ( :inlineImage[]{src="https://support.deselect.com/hc/article_attachments/360007779837/Screenshot_2020-04-18_at_16.20.34.png" alt caption width="64" height="66"}icon) to switch to comparing with fields. Dropdowns appear with the available Data Extensions and fields you can compare with. Click on the :inlineImage[]{src="https://support.deselect.com/hc/article_attachments/360007779817/Screenshot_2020-04-18_at_16.19.15.png" alt caption width="68" height="68"}icon to switch back to filter based on the value you enter.

When comparing the values of fields, the same operators are available as to when comparing with values entered by the user.

## Example

Imagine having 2 data extensions: *Products* an&#x64;*&#x20;Order Lines*. I&#x6E;*&#x20;Products* you find product details like the name, product family and the list price (the price for which the product normally sells). In *Order Lines*, you can see the quantity, product and the actual sales price.

1. Select th&#x65;*&#x20;Products* an&#x64;*&#x20;Order Lines* Data Extensions, and set the relation t&#x6F;*&#x20;Order Lines* with matching *Products*.

::Image[]{src="https://deselect.com/wp-content/uploads/2019/10/Selected-Data-Extensions.png" size="60" width="1596" height="496" isUploading="false" darkWidth="1596" darkHeight="496" showCaption="false"}

2. Add in a filter fo&#x72;*&#x20;Sales Price*. Click the **Calendar** button to switch between filtering on a fixed value and comparing with data extension fields.

::Image[]{src="https://deselect.com/wp-content/uploads/2019/10/Filter-Sales-Price.png" size="70" width="2034" height="380" isUploading="false" darkWidth="2034" darkHeight="380" showCaption="false"}

3. Two dropdowns will appear. In the first one, select the data extension you want to compare against. The second one is the field of the selected data extension you want to use. In this case, select the Products data extension and the List Price field. Your entire filter looks like this:

::Image[]{src="https://deselect.com/wp-content/uploads/2019/10/Filter-Sales-Price-List-Price.png" size="70" width="2028" height="396" isUploading="false" darkWidth="2028" darkHeight="396" showCaption="false"}

4. When you run the query, you'll get all the order lines where a product was sold for less than the list price.

