> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-mintlify-fbfa8bee.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# anyIf

> مثال على استخدام المُعدِّل anyIf

<div id="description">
  ## الوصف
</div>

يمكن تطبيق المُعدِّل [`If`](/ar/reference/functions/aggregate-functions/combinators#-if) على دالة التجميع [`any`](/ar/reference/functions/aggregate-functions/any)
لاختيار أول عنصر من عمود معيّن
يستوفي الشرط المحدد.

<div id="example-usage">
  ## مثال على الاستخدام
</div>

في هذا المثال، سننشئ جدولًا يخزّن بيانات المبيعات مع مؤشرات النجاح،
وسنستخدم `anyIf` لاختيار أول قيم `transaction_id` للسجلات التي يزيد مبلغها على 200 أو يقل عنه.

سننشئ أولًا جدولًا ثم ندرج البيانات فيه:

```sql title="Query" theme={null}
CREATE TABLE sales(
    transaction_id UInt32,
    amount Decimal(10,2),
    is_successful UInt8
) 
ENGINE = MergeTree()
ORDER BY tuple();

INSERT INTO sales VALUES
    (1, 100.00, 1),
    (2, 150.00, 1),
    (3, 155.00, 0),
    (4, 300.00, 1),
    (5, 250.50, 0),
    (6, 175.25, 1);
```

```sql theme={null}
SELECT
    anyIf(transaction_id, amount < 200) AS tid_lt_200,
    anyIf(transaction_id, amount > 200) AS tid_gt_200
FROM sales;
```

```response title="Response" theme={null}
┌─tid_lt_200─┬─tid_gt_200─┐
│          1 │          4 │
└────────────┴────────────┘
```

<div id="see-also">
  ## انظر أيضًا
</div>

* [`any`](/ar/reference/functions/aggregate-functions/any)
* [`If مُعدِّل`](/ar/reference/functions/aggregate-functions/combinators#-if)
