To enter the query for the lookup, open the Query window.
The Lookup table (actually, it is a virtual view) is made of a SELECT query with two columns (the key column and the value column). The key column corresponds with the Key Attribute selected. The value column corresponds with the Value Attribute.
To enter the query, enter a SELECT statement that returns the two-column lookup table:
SELECT <key attribute>, <value attribute> FROM <lookup table>
You can extend the SELECT command with a WHERE clause or any other valid clause accepted by the underlying database.