1 - Under 'Queries and Reports' drill down to the 'Policy Assingment' and find a query close enough to your requirements. In this case probably 'Applied Policies by Policy Name'
2 - Tick the check box next to the policy
3 - At the bottom the 'Actions' tab will have a 'View SQL' option.
This should give you the basic stucture of your SQL Query. Combine this with a ePO.API extract of the policies to get each policies unique objectID
and you should be able to fill in the missing values in your query.