The Database Join step allows you to run a query against a database using data obtained from previous steps. The parameters for this query are specified as follows:
For example, Database Join allows you to run queries looking up the oldest person who bought a specific product as shown below:
SELECT customernr FROM product_orders, customer WHERE orders.customernr = customer.customernr AND orders.productnr = ? ORDER BY customer.date_of_birth |
The grid is then defined as follows:
When the step runs, the (?) placeholder defined in the SQL query will be replaced with the incoming productnr field value from the source hop. To define and use multiple parameters, list the fields in order you want them to be replaced in the SQL statement.
The following table desribes the options for the Database Join step:
Option |
Description |
---|---|
Step name |
Name of the step; This name has to be unique in a single transformation |
Connection |
The database connection to use for the query. |
SQL |
SQL query to form the join; use question marks as parameter placeholders |
Number of rows to return |
Zero (0) returns all rows; any other number limits the number of rows returned. |
Outer join? |
Enable to always return a result, even if the query did not return a result |
Parameters table |
Specify the fields containing parameters. The parameter type is required. |