As an administrator, you would like to create an automation policy to automatically run a SQL query that will put the returned computers into a filter.
While you can accomplish this by just putting the SQL into a filter, you may want to have this done through an automation policy. In that case, you can follow these steps:
A few notes about the SQL query. Since this is going to populate a filter, you want to make sure that your SQL query is returning only GUIDs and no other data. For example, using the following query:
select top 2 guid from vcomputer