Join two rows from the same table <p>I currently have this query set-up:</p> <pre><code>SELECT topic.content_id, topic.title, image.location FROM mps_contents AS topic INNER JOIN mps_contents as image ON topic.content_id = image.page_id WHERE topic.page_id = (SELECT page_id FROM mps_pages WHERE page_short_name = 'foo' ) AND image.display_order = '1' </code></pre> <p>This is because I want to merge two rows from the same table in one row. This is a simplified setup of the table</p> <pre><code>----------------------------------------------------------- | page_id | content_id | title | location | display_order | ----------------------------------------------------------- | 1 | 200 | Foo | NULL | 200 | | 200 | 201 | Bar | jpg.jpg | 1 | ----------------------------------------------------------- </code></pre> <p>And basically I want this result</p> <pre><code>--------------------------------- | content_id | title | location | --------------------------------- | 200 | Foo | jpg.jpg | --------------------------------- </code></pre> <p>So <code>Foo</code> is the 200th topic on page 1 (<code>Foo</code> is treated as a subpage and all its contents are stored in the same table) and <code>Bar</code> is its featured image (featured only because it is the 1st image)</p> <p>The query above effectively joins the two rows (it returns my desired result) but it also returns an extra row corresponding to the original row for <code>Foo</code>, that is, the location is NULL.</p> <p>I hope someone could help me prevent the query from returning that extra row.</p>