Hi Mitch,
(select-dao 'foo-db-name (:in 'foo.id (:set (flatten (query "SELECT DISTINCT foo.id FROM foo, etc.")))))
I'm not quite sure what you are trying to achieve. Unless the 'etc' was relevant, you seem to be selecting all ids from your foo table, and then select only those rows in the foo table that have an id that exists in the foo table -- i.e., every single row. Why? If your 'etc' is a WHERE clause, you should be able to directly pass it as the test argument to select-dao.
Best, Marijn