# Join

Join a dataset with another dataset, by matching on one or more columns between the two tables.

If you pass a join\_prefix, all column names in the join table will be named "{join\_prefix}\_{columnname}". If you don't pass a join\_prefix, columns that share the same name in both tables will be only have the column from the base table included in the final output.

## Parameters

| Name          | Type         | Description                                                                                                            | Is Optional |
| ------------- | ------------ | ---------------------------------------------------------------------------------------------------------------------- | ----------- |
| join\_table   | table        | Dataset object to join with the source dataset.                                                                        |             |
| join\_type    | join\_type   | LEFT, RIGHT, or INNER                                                                                                  |             |
| join\_columns | join\_dict   | Columns to use for the join. Keys are columns in the source\_table and values are on columns in the join\_table.       |             |
| join\_prefix  | value        | Prefix all columns in the join\_table with a string to differentiate them                                              | True        |
| filters       | filter\_list | Filter logic on one or more columns. Can choose between a simple comparison filter or advanced filter using free text. | True        |

## Example

```python
internet_sales = rasgo.get.dataset(74)
product = rasgo.get.dataset(75)

ds2 = internet_sales.join(
  join_table=product,
  join_columns={'PRODUCTKEY':'PRODUCTKEY'},
  join_type='LEFT',
  join_prefix='product',
  filters=['CUSTOMERKEY IS NOT NULL', 'ORDERDATE < CURRENT_DATE()'])

ds2.preview()
```

## Source Code

{% embed url="<https://github.com/rasgointelligence/RasgoTransforms/blob/main/rasgotransforms/rasgotransforms/transforms/join/join.sql>" %}
