Documentation

    list_where

    Keep the list items whose matching position in a second list of true and false values is true.

    Also available as array_where.

    Try an expression

    In Formula, enter the expression and set Output type to VARCHAR.

    Expression

    list_where([10, 20, 30, 40], [true, false, false, true])

    Result

    '[10, 40]'

    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_where(value_list, mask_list)
    value_list
    List
    mask_list
    List
    Supported signatures (1)
    list_where(value_list: T[], mask_list: BOOLEAN[]) → T[]

    The result type can depend on the input types. See DuckDB for the full argument rules.

    Things to know

    If the first argument is missing, the result is NULL.

    Browse lists & arraysDuckDB documentation

    Function metadata from DuckDB, used under the MIT license.