filter using DISTINCT, and WHERE
added missing ;