title: Remove duplicates when joining tables
body: <p>I have a news table as follows</p>
  
  <p>News:</p>
  
  <pre><code>| id  | title                       | description
  | 1   | Breaking news               | bla bla bla
  | 2   | Heavy snowfall in london    | bla bla bla
  </code></pre>
  
  <p>a Type table as follows:</p>
  
  <pre><code>| id  | type_name   | type_code
  | 1   | weather     | 0567
  | 2   | city        | 0653
  </code></pre>
  
  <p>and a NewsType table as follows</p>
  
  <pre><code>|id | news_id | type_id | created_by |
  | 1 | 2       | 1       | "John"     |
  | 2 | 2       | 2       | "Alex"     |
  </code></pre>
  
  <p>As you can see from the NewsType table that a single news can fall into two or more types.</p>
  
  <p>I need to display news corresponding to types. A user might say give me all the news about cities and weather. To display this I am doing something like:</p>
  
  <pre><code>      select distinct n.* , nt.created_at
        from news n, newstype nt, type t where
        n.id = nt.news_id and
        t.id = nt.type_id 
        order by nt.created_at
        limit 25
  </code></pre>
  
  <p>The problem is this query returns the same news twice (I think it's because of the inner join I am doing). What should I change in the query so that if a news is classified as two types, and the user has requested to view the same two types of news, I get only single news item? instead of two!</p>