title: Select values which are distinct in a group but not overall
body: <p>I have a table like below:</p>
  <pre><code>    id  title  year
      ---------------
      1    abc   1999
      2    abc   2000
      3    abc   2000
      4    abc   1998
      5    bce   1999
      6    bce   1999
      7    def   1999
      8    def   1999
      9    def   2000
  </code></pre>
  <p>I need to get a list of titles which are distinct for a year but otherwise they can repeat. Tried distinct but it is giving distinct overall not based on year.</p>
  <p>Tried</p>
  <pre><code>SELECT DISTINCT `title` FROM xyz WHERE year IN (SELECT DISTINCT year FROM xyz)
  </code></pre>
  <p>Current output:</p>
  <pre><code>   abc
     bce
     def
  </code></pre>
  <p>Expected output:</p>
  <pre><code>   abc
     abc
     abc
     bce
     def
     def
  </code></pre>