---
schema_version: "1"
id: a28763f7ac83887426cc2eab094c045de0ad0d642aba671096eaaa381d70c93c
title: leftJoin
collection: mulesoft
version: current
locale: ja-jp
portal_url: https://docs.salesforce.com/mulesoft/current/ja-jp/dataweave/2.8/dw-arrays-functions-leftjoin.md
canonical_url: https://docs.mulesoft.com/jp/dataweave/2.8/dw-arrays-functions-leftjoin
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 54bb7ddee488ea74b431ed7b81aa2392807d1fba563e3f962a81b98c53432cf4
description: MuleSoft Documentation Site
release: "2.8"
latest: false
---
# leftJoin

## [](#leftjoin1)leftJoin<L <: Object, R <: Object>(left: Array<L>, right: Array<R>, leftCriteria: (leftValue: L) -> String, rightCriteria: (rightValue: R) -> String): Array<{ l: L, r?: R }>

オブジェクトの 2 つの配列を、指定された ID 条件で結合します。

`leftJoin`​ は、すべての ​`left`​ 項目を含む配列を返し、結合条件に一致する右の項目を ID によってマージします。

_DataWeave バージョン 2.2.0 で導入されました。_

### [](#パラメーター)パラメーター

<table class="tableblock frame-all grid-all stretch">
<colgroup>
<col style="width: 25%;">
<col style="width: 75%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">名前</th>
<th class="tableblock halign-left valign-top">説明</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>left</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">オブジェクトの左側配列。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>right</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">オブジェクトの右側配列。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>leftCriteria</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">左のコレクションの ID を抽出するために使用する条件。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>rightCriteria</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">右のコレクションの ID を抽出するために使用する条件。</p></td>
</tr>
</tbody>
</table>

### [](#例)例

次の例は、結合の動作を示しています。これは左側配列 (​`left`​) のすべてのオブジェクトを返しますが、右側配列 (​`right`​) の項目は、左側の ​`user.id`​ と右側の ​`product.ownerId`​ の値が一致した場合にのみ結合されます。

#### [](#ソース)ソース

```DataWeave
%dw 2.0
import * from dw::core::Arrays
var users = [{id: "1", name:"Mariano"},{id: "2", name:"Leandro"},{id: "3", name:"Julian"},{id: "5", name:"Julian"}]
var products = [{ownerId: "1", name:"DataWeave"},{ownerId: "1", name:"BAT"}, {ownerId: "3", name:"DataSense"}, {ownerId: "4", name:"SmartConnectors"}]
output application/json
---
leftJoin(users, products, (user) -> user.id, (product) -> product.ownerId)
```

#### [](#出力)出力

```json
[
  {
    "l": {
      "id": "1",
      "name": "Mariano"
    },
    "r": {
      "ownerId": "1",
      "name": "DataWeave"
    }
  },
  {
    "l": {
      "id": "1",
      "name": "Mariano"
    },
    "r": {
      "ownerId": "1",
      "name": "BAT"
    }
  },
  {
    "l": {
      "id": "2",
      "name": "Leandro"
    }
  },
  {
    "l": {
      "id": "3",
      "name": "Julian"
    },
    "r": {
      "ownerId": "3",
      "name": "DataSense"
    }
  },
  {
    "l": {
      "id": "5",
      "name": "Julian"
    }
  }
]
```