Value mapping query can be set to an attribute using a DQL query.
Syntax:
ALTER TYPE type_name MODIFY attr_name (VALUE_ASSISTANCE IS QUERY '<query>' qry attr = attr_name allow caching is complete)
Example:
ALTER TYPE custom_type MODIFY custom_attr (VALUE_ASSISTANCE IS QUERY 'select custom_attr from custom_lookup order by custom_attr' qry attr = custom_attr allow caching is complete)