title: DAL design: handling access to 2 or more tables in a database?
body: <p>I'm developing on php at the moment, but this question should be language independent.</p>
  
  <p>For DB access, I have always heard people promoting the "one class per table" practice, so I'm wondering where to put access methods that accesses 2 or more tables at the same time (using JOIN, for example). I can think of 3 ways to deal with this:</p>
  
  <ol>
  <li>Create a separate class for the combination of the 2 tables</li>
  <li>Put the access methods in the class for both tables</li>
  <li>Have the BLL call each db class separately and write custom logic to get what you need (i.e. do the join outside of SQL)</li>
  </ol>
  
  <p>What is the best practice and why?</p>
  
  <p>Thanks!</p>