title: plsql/sql is it possible to limit the rows returned from a join, or do some kind of subquery on a per-row basis?
body: <p>I am doing a query that finds all cats born between two dates. Each cat has a name, or multiple names.</p>
  
  <p>The initial query is something like</p>
  
  <p><code>SELECT Id, Color FROM Cat WHERE Cat.BirthDate &gt; dat_min AND Cat.BirthDate &lt; dat_max;</code></p>
  
  <p>I also have a table called <code>CatName</code> which for each Cat Id, has one or more names that this cat has been given by its different owners. I only want to return the first name that matches the Id in the <code>CatName</code> table, as part of the query. So something like:</p>
  
  <p><code>SELECT Id, Color, Name FROM Cat JOIN CatName on .....</code></p>
  
  <p>for a cat that has 5 names, will return 5 rows. I only want one row, the first one. If I was only retrieving data for one cat, then I would just use ROWNUM to limit it to 1 query, but I am trying to get a list of all cats including their name, so I can't do this.</p>
  
  <p>Can anyone offer some guidance? I guess it doesn't have to be plsql specific, the technique will be the same I imagine.</p>