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:
- From the SMP console, open Manage > Filters. Right-click and choose new Filter. The filter can be empty.
- From the SMP console, click Manage > Jobs and Tasks:
- Right-click in an area of your choosing and choose New > Task.
- Find the task Add to Filter and select it.
- As shown in the following screenshot, click Select Filters and choose the filter you created in the steps above. Click OK when done to save the task.

- Navigate to Manage > Automation Policies
- Click New Policy to create a new automation policy.
- Give your new automation policy a name and then set a schedule according to your needs.
- Data Source: RAW SQL Query
- Click the Edit Query link and put your SQL query into the parametrized query window.
- Leave for nonempty data selected
- Next, to select/job or task, click the link to open and choose the Add to Filter task you created above.
- Click the edit input parameter link

- After clicking the edit input parameter link, under Resources, use the drop-down to select [guid] (value list). Click OK to go back to the automation policy.

- Save your automation policy and test it. When running it you should see the filter that you selected show the computers returned by your SQL query. Remember that you might have to click on update membership when viewing the filter to see the computers listed.
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