join command: Examples

The following are examples for using the SPL2 join command.

1. Join datasets on fields that have the same name

Combine the results from a search with the vendors dataset. The data is joined on the product_id field, which is common to both datasets.

2. Join datasets on fields that have different names

Combine the results from a search with the vendors dataset. The data is joined on a product ID field, which have different names. The field in the left-side dataset is product_id. The field in the right-side dataset is pid.

3. Use words instead of letters as aliases

You can use words for the aliases to help identify the datasets involved in the join. This example uses products and vendors for the aliases.

4. Return all matching rows in the right-side dataset

By default, only the first row of the right-side dataset that matches a row of the source data is returned. To return all of the matching right-side dataset rows, include the max=<int> argument and set the value to 0. This example joins each matching right-side dataset row with the corresponding source data row. This example uses products, which is a saved dataset, for the right-side dataset. In this example the field names in the left-side dataset and the right-side dataset are different.

5. Return all matching rows in a subsearch

This example uses a subsearch for the right-side dataset.