list_intersect
Return the distinct items that appear in both lists.
Also available as array_intersect.
Try an expression
In Formula, enter the expression and set Output type to VARCHAR.
Expression
list_intersect([1, 2, 3], [2, 3, 4])Result
'[2, 3]'The expression returns INTEGER[]. Formula stores it as VARCHAR in this example. To use your own data, replace the example values with column names. Keep format strings and other options as written.
Arguments and types
list_intersect(list1, list2)- list1
- List
- list2
- List
Supported signatures (1)
list_intersect(list1: T[], list2: T[]) → T[]The result type can depend on the input types. See DuckDB for the full argument rules.
Things to know
The result contains distinct shared values. Sort the result separately if you need a predictable element order.
If the first argument is missing, the result is NULL.
Sort the shared values
list_sort(list_intersect([1, 2, 3], [2, 3, 4]))'[2, 3]'
Function metadata from DuckDB, used under the MIT license.