Forgot to include %s in the select distinct statement.