Use the USING LOOKUP clause to return records that are limited by a lookup filter on a field.
With API version 32.0 and later, you can use USING LOOKUP to limit the results of a query with a lookup filter. The syntax is:
[USING LOOKUP lookupField]
The USING LOOKUP clause uses the lookup filter that’s applied to the specified field. For example, the following query returns the IDs of Accounts, filtered by the lookup filter in the Account field on the Contact object:
SELECT Id FROM Account USING LOOKUP Contact.AccountId
You can use USING LOOKUP with multiple FROM clauses, like this:
SELECT c.Id, a.Id from Contact c USING LOOKUP obj.Contact__c, c.Account a USING LOOKUP Contact.AccountId
You can also use USING LOOKUP and USING SCOPE together:
SELECT Id FROM Account USING LOOKUP Contact.AccountId, SCOPE Mine