# Match (SQL)

The Match (SQL) tab allows you to specify SQL Matching on a table.

SQL matching operates by specifying a SQL SELECT statement to use to identify the matching records in the target. This is very different to the normal matching, which builds an in memory index on the table before the import starts. See Match Types and SQL Matching for more information.

To create a SQL Match, you need SQL SELECT statement that returns the primary key from the table. Use the "Enter initial SQL" button to have Inaportinsert a SELECT statement. You will need to complete the WHERE clause.

The SQL may use a parameter that will be replaced by Inaport at run time:

#PARENTKEY will be replaced with the value of the primary key from the matched parent table record

In addition, you may usefield names from the incoming source record; Inaportwill replace the field name with the value of the field.

Example: suppose you are matching on the Person table in Sage CRM, and it is a child of Company. You have a field called "lastname" in the source record. The following would be valid SQL:

SELECT pers_personid FROM person WHERE pers_companyid = #PARENTKEY and pers_lastname = '#lastname'